Skip to content

Kiro Crew

A Crew app keeps the gateway answering.

QSOLink Gateway Keeper is an app for Kiro Crew, a Kiro tool that runs scheduled jobs and agents. Every minute it reads a mailbox folder, sends each line to the gateway and logs the reply. A page in Crew lists the traffic, and Crew sends you a notification when the gateway stops answering. Source: crew/.

The QSOLink page inside Kiro Crew. A green line reads gateway answering, 0 pending. Counters show 6 messages, 2 ghost lines and an average reply of 94 bytes. The traffic table lists six rows newest first with time, callsign, template and bytes; the EMAIL row from W6XYZ and the WX row from K1ABC show the ghost lines EMAIL:a@b.org:SUBJ:BODY and WX:97035.
The dashboard page in Kiro Crew 0.13.1 after a test run: six exchanges, two of them ghost lines that name the line to key next.

How a line moves

The inbox folder stands in for the radio modem, called a TNC, that would hand lines to the gateway.

  1. Step 1

    Inbox

    data/inbox/W1AW.txt

    One operator line per file. The file name starts with the callsign.

  2. Step 2

    Poll

    scripts/poll.py

    Crew runs the script every 60 s. It starts node src/poll.mjs and makes no model call.

  3. Step 3

    Gateway

    POST /api/key

    The poller sends the line to QSOLink and gets back a reply or a ghost line.

  4. Step 4

    Outbox

    data/outbox/W1AW.txt

    The reply goes to a file of the same name. The inbox file moves to data/inbox/done/.

  5. Step 5

    Dashboard

    data/traffic.jsonl

    One row per exchange. The Crew page reads the rows through the app's backend.

When the gateway is down

A poll that cannot reach the gateway fails its run and sends you a Crew notification. The line stays in the inbox, and the next poll a minute later tries it again.

Once an hour the gateway-keeper agent reads data/status.json. Its one goal is to keep the gateway answering. When the last poll failed, it names the failing URL and the one command to run.

The manifest lists data in agentReadOnlyDirs, so the agent can read the mailbox and cannot change it.

A poll also watches its own clock. It starts a request only when a full request timeout still fits in its 160 s budget, so Crew never kills it halfway through a request.

The top of the QSOLink page in Kiro Crew with the gateway stopped. A red line reads gateway down: gateway unreachable: ECONNREFUSED, 1 pending. The counters show 5 messages, 2 ghost lines and an average reply of 94 bytes.
The same page with the gateway stopped. One line waits in the inbox. Full screenshot.

QSOLink gateway is not answering: gateway unreachable: ECONNREFUSED. 1 line(s) wait in data/inbox/. Start it with `npm start` in the qsolink repo.

The text scripts/poll.py sends, filled in with the error from that run.

An hourly net log

Radio nets keep a log of who sent what. The net-log cron does the same for the gateway. Code does all the counting. The keeper agent only reports the result.

  1. Step 1

    Traffic log

    data/traffic.jsonl

    The rows the poller wrote since the last net-log entry, plus the replies in data/outbox/.

  2. Step 2

    Count

    scripts/net-log.py

    Crew runs the script every hour. It starts node src/net-log-run.mjs and makes no model call.

  3. Step 3

    Entry

    data/net-log.jsonl

    One JSON entry for the window, and the latest after-action summary in data/net-log.txt.

  4. Step 4

    Report

    dashboard and gateway-keeper

    The Crew page shows the latest entry. The keeper agent reads net-log.txt and quotes it.

Each entry covers its own window, so a row is counted once. The script reads data/outbox/ for the reason behind each ghost line and for weather replies marked CACHED. An hour with no traffic writes nothing.

The entry counts messages per template, ghost lines and the ghost-line rate, reply bytes against the byte budget, cached weather replies and the top failure. The keeper agent quotes data/net-log.txt in its hourly reply and never recomputes a number.

data/net-log.txt, from a local run
Messages: 7 (WX 6, HFAsk 1)
Answered 5, ghost lines 2, refused by the poller 0. Ghost-line rate 28.6%.
Reply bytes: average 99, largest 125, budget 256 per reply. Budget use 38.8%. Over budget: 0.
Cached weather replies: 5.
Top failure: NO SOURCE (1).

Three crons in the manifest

The poll and the net log are script crons, so they cost no model turn. The hourly check is an agent cron. All three come from crew/app.json.

crew/app.json
"crons": [
  {
    "name": "poll-mailbox",
    "every": 60,
    "timeout": 170,
    "timeout_secs": 180,
    "script": "scripts/poll.py:run"
  },
  {
    "name": "net-log",
    "every": 3600,
    "timeout": 50,
    "timeout_secs": 60,
    "script": "scripts/net-log.py:run"
  },
  {
    "name": "keeper-check",
    "every": 3600,
    "agent": "gateway-keeper",
    "message": "Read ~/.kiro/crew/apps/qsolink-crew/data/status.json and data/net-log.txt (under $KIROCREW_HOME/apps/qsolink-crew/data/ if the gateway uses a custom data home). Your working folder is empty, so use those full paths. If status.json has ok true and is under 10 minutes old, reply with one line, and add one line quoting the top failure and ghost-line rate from net-log.txt if the file exists. Otherwise say which URL failed and why, and name the one command the owner should run.",
    "persistent_session": false
  }
]

Install

You need Kiro Crew 0.13.0 or later and Node 22.18 or later.

  1. 1.Start the gateway so the app has something to poll.

    shell
    npm start        # QSOLink gateway on http://localhost:8787
  2. 2.Install the app from the crew/ folder, or from the git URL with --subdirectory, then enable it.

    shell
    kirocrew app install ./crew
    kirocrew app install https://github.com/ashutosh887/qsolink.git --subdirectory crew
    kirocrew app enable qsolink-crew

    Crew blocks third-party app code until you trust the app from the App Store prompt in its dashboard.

  3. 3.Put a line in the mailbox. The next poll answers it.

    shell
    mkdir -p ~/.kiro/crew/apps/qsolink-crew/data/inbox
    echo "WX:97035" > ~/.kiro/crew/apps/qsolink-crew/data/inbox/W1AW.txt

To run a poll now, find the job id with kirocrew cron list and run kirocrew cron trigger with it. You can also run the poller and the dashboard without Crew; see crew/README.md.

What we checked

On 28 and 29 November 2026, against Kiro Crew 0.13.1 and a local QSOLink gateway.

  • The app installed and enabled, and registered the crons, the gateway-keeper agent and the backend. kirocrew cron list shows poll-mailbox every 1m and keeper-check every 1h.
  • A triggered poll answered WX, POS, HFAsk and EMAIL lines, and gave each bad line a ghost line.
  • With the gateway stopped, the run failed with ECONNREFUSED, the line stayed in the inbox and Crew raised a notification. After a restart the next run answered it.
  • The hourly net log ran on 29 November 2026 against a local gateway with its NOAA access cut off. Seven lines gave the counts in the net log above, and the next window started where the first ended and counted none of the earlier rows.
  • The backend returned 401 to an unsigned request and 200 through the Crew proxy.
  • A keeper-check turn ran on 29 November 2026. The first run could not find the app folder, because the agent starts in an empty folder. After the cron message and agent prompt named the full path, the second run read status.json and replied: "Gateway is up (http://localhost:8791), the status is 1 minute old, and 0 lines are pending."
  • On 30 November 2026 the keeper-check turn ran inside a live Crew 0.13.1 gateway. It read status.json and net-log.txt and answered: "Gateway is up, with 0 lines pending. Net log says: ghost-line rate 0%, top failure: none." Both numbers match the file as written.
  • 53 tests pass in crew/test/, including a property test that the net-log totals equal the sum of their parts. The poller tests use a fake gateway and a fake clock.

The keeper-check turn used a throwaway Crew home with a signed-in kiro-cli, and the gateway on a spare port. That test home keeps the app outside ~/.kiro/crew, so its cron message was edited to the test path. The default path in the manifest was not run on a default home. The spec for this app is keep-gateway-answering.