@comchatx/cx-subagents
Puts what cx does in the background on the board.
Package details
Install @comchatx/cx-subagents from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@comchatx/cx-subagents- Package
@comchatx/cx-subagents- Version
0.2.0- Published
- Nov 6, 2026
- Downloads
- 432/mo · 432/wk
- Author
- hs_jack_yzy
- License
- MIT
- Types
- extension
- Size
- 15.2 KB
- Dependencies
- 0 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./extensions/board-cards.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
When cx hands work to the background, a card for it appears under To do on the board. It holds what cx asked for. When the work is done, the same card shows its result. If it is not done after 30 minutes, the card says 超时 and shows what was done so far.
It needs pi-subagents, which runs the work in the background, and @comchatx/cx-board, the board. The Plugins page installs both with it. With pi-subagents alone, cx still works in the background, and no card is written.
When cx's computer stops
If cx's computer stops before the work is done, its card stays as it was when the work started.
What it costs
The work in the background uses the same model as cx and is paid from the same balance. cx's computer stays on while it runs, and that time is billed.
How it is built
One extension,
extensions/board-cards.ts. pi loads it as TypeScript; there is no build. It ships no skill. When cx hands work to the background is cx's own judgement with pi-subagents'subagenttool.What it listens to. pi-subagents emits
subagent:async-startedandsubagent:async-completeon the session's event bus. The start carries the run id and thesubagentcall's id, and redacts the task. The extension takes the task from pi's owntool_callevent for that call. The end carries the result.The card. It goes in
board/<person>/todo/under the session's directory, which in cx's computer is/tenant. The person is the one directory underboard/; a board with none, or with more than one, gets no card. This is the board's shape ascx-boarddescribes it. The extension imports nothing fromcx-boardand calls nothing of the board's.- The name is
<YYYYMMDD-HHMMSS>-subagent-<run id>.md, the start's time in UTC. - The front matter is
kind: finding, atitleand anat. The title is the task's first line, at most 200 characters.atis the start. - The words are the task as given. They are cut where the whole file would pass the 32 KiB the board reads.
- The name is
At the end the same file in
todo/is rewritten, its name, title andatkept. The words become:- a single run's own output;
- each run's output under its agent's name, for several;
- at the deadline, 超时, then what the run had written. pi-subagents' own note on the stop, its "Recovery summary", is left out.
Nothing is moved. A card the seller has already marked read stays in
done/, and the result is a card again intodo/under the same name. A second start of the same run id overwrites its card. A run that ends after cx's computer stopped leaves its card as it started.pi-subagents' config is carried by the box, not this package.
asyncByDefaultsends a run to the background.toolActivation: "eager"offers thesubagenttool from the first request.maxActiveAsyncRunsPerSession: 2caps the runs in one conversation at two. The 30 minutes is pi-subagents' own default for a background run.
Tests
The tests run against pi-subagents 0.85.0 on pi 1.4.0, the versions cx's computer runs.
test/board.test.ts, on the pinned pi in RPC mode with a scripted model on loopback, as a box starts pi. Each card is read by the board's own reader, copied intotest/fixtures/board-reader.tswith its source lines named.- A
subagentcall writes a started card whose title is the task's first line. The result rewrites the same file. - A run stopped at its deadline writes 超时 with what it had.
- Two runs write two files.
- The same run id started again overwrites its card.
- A
test/board-cards.test.ts, the extension on a bus of its own:- the name and the front matter;
- a card found again after a reload;
- nothing moved;
- the task of a chain or a parallel run;
- no card where the board is not one person's;
- the 32 KiB cut;
- the end's words.
test/package.test.ts:- pi lists no skill from the package and loads its one extension;
- the package ships the extension alone;
- the package names
pi-subagentsand@comchatx/cx-boardincomchatx.builds.
test/background.test.ts:- a run goes to the background and its result comes back into the conversation;
- the box's config caps the runs at two.
Release
.github/workflows/release.yml publishes each version on a v<version> tag, once this repository is the package's trusted publisher on npm. Until then a maintainer publishes by hand, npm publish --access public from a checkout of the merged tag.