Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# CHANGES — applied substitutions

## Unreleased: agent monitor
## Unreleased: lane journal

- Add `/pstack:monitor` and `pstack-monitor`, a read-only local server that draws pstack work on this machine as a live node canvas: each session that runs pstack, every subagent it spawns, and external Codex, Grok, DeepSeek, and MiniMax lanes, with each agent's model and messages. `--all` or **Show all** shows every session. Tracked in [pstack-flex #23](https://github.com/thisguymartin/pstack-flex/issues/23).
- Status comes from process records, turn boundaries, parent results, and lane receipts, never file times. The page separates working, waiting for input, stalled, and finished, and shows each agent's task, the tool call it waits on, and its latest step.
- The agent panel resizes by dragging its edge or with a widen button, and remembers its width.
- `pstack-runner` writes an opt-in lane journal (start record with the head of the prompt, stdout as it arrives, receipt copy) under `~/.pstack-flex/lanes/` while that directory exists. `--label` names a lane. A journal failure never changes a lane's receipt, exit status, or output.
- `pstack-runner` writes an opt-in lane journal (start record with the head of the prompt, stdout as it arrives, receipt copy) under `~/.pstack-flex/lanes/` while that directory exists. `--label` names a lane. A journal failure never changes a lane's receipt, exit status, or output. [psf-monitor](https://github.com/thisguymartin/psf-monitor) reads the journal to show lanes while they run; the agent monitor that first shipped here moved there. Tracked in [pstack-flex #23](https://github.com/thisguymartin/pstack-flex/issues/23).

## Unreleased: merge open-pstack 1.5.0 (Cursor pstack 0.15.5)

Expand Down
1 change: 0 additions & 1 deletion NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ Files authored for this port (not derived from upstream):
- `plugins/pstack/skills/babysit/SKILL.md` (independently authored; workflow informed by Cursor's public `/babysit` behavior)
- `plugins/pstack/agents/pstack-fable-*.md` and `plugins/pstack/agents/pstack-opus-*.md` (Claude-native frontier lanes at each selectable effort)
- `plugins/pstack/hooks/hooks.json`, `plugins/pstack/hooks/session-start`, and `plugins/pstack/hooks/session-start-context.md` (the SessionStart hook and its opt-in gate)
- `plugins/pstack/skills/monitor/SKILL.md` and `plugins/pstack/skills/poteto-mode/scripts/monitor/` (the pstack-flex agent monitor)
- `NOTICE.md` (this file)
- `README.md`
- `CHANGES.md`
Expand Down
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,11 @@ Use pstack:poteto-mode. Add saved filters to search. Keep the design simple, ver

For that feature, poteto-mode should first understand how search works today. It should decide how the data should be represented before writing code, implement the smallest complete version, run the feature the way a user would, review the result, and prepare the pull request.

That is the main workflow. The other skills are there when poteto-mode needs them or when you want to call one directly. **[docs/USAGE.md](docs/USAGE.md)** is the longer walkthrough: three setup configurations (full frontier, hybrid saver, zero-subscription), copy-paste examples for the daily skills, how to read receipts, watching your agents, and troubleshooting.
That is the main workflow. The other skills are there when poteto-mode needs them or when you want to call one directly. **[docs/USAGE.md](docs/USAGE.md)** is the longer walkthrough: three setup configurations (full frontier, hybrid saver, zero-subscription), copy-paste examples for the daily skills, how to read receipts, and troubleshooting.

### 3. Watch your agents (optional)

The monitor does not start by itself. Start it when you want to watch a run:

```text
/pstack:monitor
```

In Codex, ask for `pstack:monitor`. It prints a link to a local page that draws each session running pstack, the agents it spawned, the external lanes pstack launched, and what each one is doing now, live. It keeps running in the background until you say "pstack, kill the monitor" or restart the machine. See [Watching your agents](docs/USAGE.md#watching-your-agents-the-monitor) for the terminal commands and troubleshooting.
The agent monitor is a separate plugin, [psf-monitor](https://github.com/thisguymartin/psf-monitor). Install it next to pstack to watch each pstack session, the agents it spawned, and the external lanes pstack launched, live, and to cancel a running lane from the page.

## Useful skills

Expand All @@ -167,7 +161,6 @@ In Codex, ask for `pstack:monitor`. It prints a link to a local page that draws
| `maintain-verification-skill` | The project's verification instructions no longer match the product. |
| `babysit` | A pull request needs CI failures and review comments handled until it is ready. |
| `reflect` | A hard task is finished and its lessons should improve the next run. |
| `monitor` | You want to watch your agents work: a live graph of each pstack session, its subagents and model lanes, and what each is doing now. |

Plugin skills include `pstack:` in their name. In Claude Code, invoke a native skill such as `/pstack:architect`. In Codex, ask for the skill, such as `Use pstack:architect for this design.` See the [technical reference](docs/reference.md) for the full list.

Expand Down
1 change: 0 additions & 1 deletion UPSTREAM-FLEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ All flex changes are additive and live in port-owned files so upstream merges st
- The assignment-first restructure of `skills/setup-pstack/SKILL.md`
- `docs/LANES.md`, this file, the README fork section, and the NOTICE/LICENSE/CHANGES additions
- `plugins/pstack/hooks/session-start-context.md`, which the fork rewrote from open-pstack's auto-fire mandate into an opt-in gate, and the docs lines that describe it
- The agent monitor: `plugins/pstack/skills/monitor/`, `plugins/pstack/skills/poteto-mode/scripts/monitor/`, the `monitor` entries in the scripts `package.json`, and the "Agent monitor" section of `docs/reference.md`. Upstream has no equivalent, so none of these conflict on a sync.
- The lane journal: `runner/flex-journal.ts` and its test (new), its call sites in `runner/{types,run,cli}.ts` (an optional stdout callback on the model run, the journal opened after output reservation and finished on both return paths, and the `--label` flag), the journal tests in `run.test.ts`, and the pstack-flex paragraph after the invocation block in `references/provider-dispatch.md`. On a sync, keep these call sites; they change no receipt or exit status.

Every upstream skill body is byte-unchanged except for the default-descriptor mentions listed above. Since [#17](https://github.com/thisguymartin/pstack-flex/issues/17), the stock matrix carries three fork-owned GPT-6 rows and the first-run sheet uses them, so those two surfaces conflict on every upstream sync and are resolved by hand: keep the fork's rows and defaults, take upstream's wording for everything else.
Expand Down
59 changes: 3 additions & 56 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,64 +218,11 @@ Every external lane writes a JSON receipt next to its output. The fields that ma
| `usage` | real token counts — trust these |
| `costUsd` | real for claude/grok subscription lanes; **always `null` on gateway lanes** (the CLI would price at Anthropic rates). Multiply `usage` by the [LANES.md](LANES.md) table instead |

## Watching your agents: the monitor
## Watching your agents

The monitor is a local web page that shows pstack work on this machine as a live graph. Each session that runs pstack appears with every agent it spawned: native Claude and Codex subagents, and external Codex, Grok, DeepSeek, and MiniMax lanes. Click an agent to see its task, what it is doing now, and its full activity.
The agent monitor moved to its own plugin, [psf-monitor](https://github.com/thisguymartin/psf-monitor). It draws each pstack session, the agents it spawned, and the external lanes pstack launched as a live graph, and can cancel a running lane.

A session counts as pstack work once it runs a `/pstack:` command, a pstack skill, or a pstack agent (in Codex, a prompt that names pstack or a call into pstack's skills or runner). **Show all** in the session list, or `start --all`, shows every session instead.

Status comes from evidence:

| Shown | Meaning |
| --- | --- |
| working | the process is busy, or the agent is mid-turn |
| waiting for input | the session's process is open and idle |
| stalled | a turn started and has been silent for 15 minutes with no live process behind it |
| quiet | still working, but nothing new for 90 seconds |
| done, failed, cancelled | the agent or lane recorded an outcome |
| ended · process gone | the process exited without an outcome |

### Start and stop

Nothing starts the monitor for you. Start it once; it runs in the background until you stop it or restart the machine.

```text
/pstack:monitor # Claude Code
Use pstack:monitor. # Codex
```

Either prints a link such as `http://127.0.0.1:47317/?token=…`. The token changes on every start. From a terminal, run the launcher inside the installed plugin (it needs Bun):

```shell
~/.claude/plugins/cache/open-pstack/pstack/<version>/skills/poteto-mode/scripts/monitor/pstack-monitor start --parent claude
~/.codex/plugins/cache/open-pstack/pstack/<version>/skills/poteto-mode/scripts/monitor/pstack-monitor start --parent codex
```

Options: `--all`, `--port <n>` (default 47317), `--hours <n>` (default 24), `--focus <session id>`.

| Ask pstack | Or run | What happens |
| --- | --- | --- |
| "pstack, kill the monitor" | `pstack-monitor stop` | Stops the server. Agents keep running. |
| "is the monitor running?" | `pstack-monitor status` | Prints counts and the link. |
| | `pstack-monitor doctor` | Reports how well recent transcripts parsed. |
| | `pstack-monitor journal off` | Stops recording lanes and deletes the records. |

### External lanes

The first `start` turns on the lane journal in `~/.pstack-flex/lanes/`, kept for 7 days, so lanes show while they run. Codex and Grok lanes stream. Claude, DeepSeek, and MiniMax lanes show their reply when they exit. Lanes started while the journal was off do not appear.

The monitor reads the transcripts in `~/.claude` and `~/.codex` (or `CLAUDE_CONFIG_DIR` and `CODEX_HOME`), writes only `~/.pstack-flex/monitor/` and the journal, listens on `127.0.0.1` only, and accepts no writes.

### When something looks wrong

| Symptom | Fix |
| --- | --- |
| `port 47317 is unavailable` | `pstack-monitor start --port 47400` |
| "Link expired" | the monitor restarted; run start again and open the new link |
| Start fails in a sandboxed session | run the start command in your own terminal (in Claude Code, after `!`) |
| A session is missing | it has not run pstack yet; click **Show all** |
| A banner says a source is degraded | run `pstack-monitor doctor` and open an issue with its output |
| An external lane never appears | `pstack-monitor journal status`, then `journal on` |
pstack's side is the lane journal. While `~/.pstack-flex/lanes/` exists, `pstack-runner` records each external lane's start, its output as it streams, and a copy of its receipt there. psf-monitor creates that directory when it starts. Delete the directory to stop journaling. A journal failure never changes a lane's receipt, exit status, or output.

## Cost playbook

Expand Down
16 changes: 4 additions & 12 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The marketplace install is the normal user path. Direct links are only for testi
│ ├── .codex-plugin/plugin.json # Codex manifest (skills: ./skills/)
│ ├── skills/ # 55 skills shared by Claude Code and Codex
│ │ ├── poteto-mode/references/{codex-tools,provider-dispatch}.md # tool + provider routing
│ │ └── poteto-mode/scripts/ # bun/bash/node tooling: watch-pr, orch, runner, monitor, check-plan.mjs, worktree-audit.sh
│ │ └── poteto-mode/scripts/ # bun/bash/node tooling: watch-pr, orch, runner, check-plan.mjs, worktree-audit.sh
│ ├── hooks/ # SessionStart opt-in gate: pstack runs only on request (Claude Code and Codex)
│ └── agents/ # Claude subagents, including native Fable and Opus lanes at each selectable effort
├── tests/skill-collision-repro.sh # native-skill package invariants and Claude invocation checks
Expand Down Expand Up @@ -151,20 +151,12 @@ The table uses the short upstream names. Claude Code exposes each native skill w
| `/fix-merge-conflicts` | non-interactively resolve merge conflicts, validate, finalize |
| `/get-pr-comments` | fetch and summarize review comments from the active PR |
| `/what-did-i-get-done` | summarize authored commits over a user-chosen period |
| `/monitor` | open a live local view of running agents, their spawn tree, and each agent's activity (pstack-flex) |

## Agent monitor
## Lane journal

`/monitor` starts `skills/poteto-mode/scripts/monitor/pstack-monitor`, a read-only server on `127.0.0.1` (default port 47317), and prints a link with a per-start access token. The page draws one session's agents as a node canvas and streams any agent's timeline in a resizable side panel.
`pstack-runner` writes an opt-in journal under `~/.pstack-flex/lanes/` (or `PSTACK_FLEX_LANES_DIR`) while that directory exists. Each lane gets one directory holding `lane.json` (schema version 1: provider, model, effort, mode, label, the first 300 characters of the prompt, runner pid, parent harness and session), `stream.jsonl` (stdout as it arrives), and `receipt.json` (a copy of the receipt). Sending SIGTERM to the runner pid cancels the lane and writes a `cancelled` receipt. A journal failure never changes a lane's receipt, exit status, or output.

- **Scope.** The server indexes every Claude Code and Codex session and marks a spawn tree as pstack work when any member shows pstack evidence: `attributionPlugin`/`attributionSkill`/`attributionAgent` on Claude records, a `Skill` or `Agent` call naming `pstack:`, a `/pstack:` command, a `pstack:` subagent sidecar, a Codex root prompt naming pstack or a call into `pstack-runner` or pstack's skills, or any runner lane. The page shows marked trees by default; **Show all** or `?all=1` (`start --all`) shows everything.
- **Sources.** Claude Code session and subagent transcripts, `.meta.json` sidecars, and `~/.claude/sessions/<pid>.json` process records; Codex rollouts under `~/.codex/sessions/`. No hook, no harness setting. `CLAUDE_CONFIG_DIR`, `CODEX_HOME`, and `PSTACK_FLEX_MONITOR_DIR` move them.
- **Status comes from evidence, never file times.** A terminal session follows its live process record (`busy` is working, `idle` is waiting for input). Sessions without one, and Claude subagents, follow turn boundaries: a human prompt opens a turn and an `end_turn` reply closes it. A subagent is done when its own turn ends or its parent records the result, whichever comes first. A Codex thread follows `task_started` and `task_complete`. The page adds two qualifiers: quiet after 90 s without stamped activity, and stalled once a turn-only run has been silent for 15 minutes.
- **Activity.** Each agent carries its latest prompt, the tool call still awaiting a result, and its latest step. Cards, the session list, and the panel's Task and Now lines show them.
- **External lanes.** `pstack-runner` writes an opt-in journal under `~/.pstack-flex/lanes/` (or `PSTACK_FLEX_LANES_DIR`) while that directory exists: `lane.json` (provider, model, effort, label, the first 300 characters of the prompt, runner pid, parent session), `stream.jsonl` (stdout as it arrives), and `receipt.json`. `pstack-monitor start` creates it, `journal off` deletes it, and the server prunes lanes older than 7 days. Codex and Grok lanes stream; Claude, DeepSeek, and MiniMax lanes print one result at exit. A journal failure never changes a lane's receipt, exit status, or output.
- **Messages between agents.** Arrowed arcs with a count, from Codex agent messages (addressed by agent path) and Claude Code `SendMessage` calls. Messages to another session's socket are left off.
- **Format drift is visible.** Unrecognized and malformed records are counted per source; the page shows a banner and `pstack-monitor doctor` prints counts and CLI versions, never content.
- **Lifecycle and security.** `start` reuses a running server of the same build and replaces another build. The server binds loopback, rejects foreign `Host` and `Origin` headers, accepts no writes, requires the token (exchanged for an `HttpOnly`, `SameSite=Strict` cookie) everywhere except a data-free health check, and renders transcript text only as text. Nothing times it out.
[psf-monitor](https://github.com/thisguymartin/psf-monitor) reads this journal to show lanes while they run. It keeps its own copy of the schema, so a change to `lane.json` needs a matching psf-monitor change.

## Subagents

Expand Down
27 changes: 0 additions & 27 deletions plugins/pstack/skills/monitor/SKILL.md

This file was deleted.

Loading
Loading