agentleFS
Hive-AcademyHive-Academy/ptah-extension/.claude/skills/agent-lanes/SKILL.md

agent-lanes

Skill29 starsChanged 2 months agoMITView on GitHub

Contract for spawning, resuming and messaging background CLI agent lanes via the ptah_agent_* tools. Load before any ptah_agent_spawn, or when orchestration or tribunal refers here.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 2 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Report before exiting: call ptah_agent_report once before the final message, naming what was produced, the absolute path of every file …

    line 67
  2. Very specific:

    Git: never commit, push or run history-changing git — unless the workflow gives the lane its own throwaway worktree and says so.

    line 71
  3. Very specific:

    Blocked: if it cannot proceed, write the blocking questions under ## Clarifications Needed in the deliverable and stop.

    line 75
  4. Very specific:

    Preserve list: when replacing, consolidating or deleting an existing surface, list what it can do today (or pass parity-inventory.md in …

    line 77
  5. Very specific:

    When the work calls for a role, pass it as the role parameter — never paste a role template into task.

    line 84
  6. Very specific:

    Do not poll in a loop: When a lane reaches a terminal status, Ptah pushes one <agent-lane-completed> turn into the session that spawned it.

    line 96
  7. Distinctive:

    no signal arrived — the signal is refused when the spawning session is no longer live, when the lane was spawned with no parent session, or …

    line 115
  8. Very specific:

    No session id → that adapter is ephemeral: respawn with the context restated in task.

    line 133
  9. Distinctive:

    Every spawn, resume, message turn and review round is a real paid call.

    line 210
  10. Very specific:

    Default ceiling: 40 tool calls per lane.

    line 219

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Agent Lanes

A lane is one background agent started with ptah_agent_spawn: an installed system CLI or a configured ptah-cli provider. This skill is the one place lane mechanics are written. Workflows (orchestration, tribunal) decide what a lane does; this decides how to run it.

1. Discover

No ptah_agent_* tools in this session → do the work natively and say so. Otherwise call ptah_agent_list before choosing. Its rows are the only lanes that exist on this machine now. The cli enum on the ptah_agent_spawn schema lists adapters this build ships, not what is installed.

| Agent        | Type     | Status        | Capabilities                                              |
| ------------ | -------- | ------------- | --------------------------------------------------------- |
| cursor       | cli      | not installed | messaging: none                                           |
| ollama cloud | ptah-cli | available     | provider: Ollama Cloud, ptahCliId: pc-d8f4…, messaging: … |

That sample is one machine's output at one moment — yours will differ.

  • Type: cli + installed → spawnable with cli. Any other status (not installed, disabled) → skip.
  • Type: ptah-cli + available → spawnable with ptahCliId.
  • Family = the cli value, or the provider: token of a ptah-cli row. Families matter for review.
  • A Claude provider is an ordinary ptah-cli row: not privileged, not excluded.
  • The user named a lane that is not listed → say which one is missing and offer the listed alternatives. Never substitute silently.
  • Vendor names anywhere in skill text are illustrations, never a roster.

2. Address

ParamUse
taskRequired. The self-contained prompt (§3).
cliA system CLI from an installed row. Omit for the user's default CLI.
ptahCliIdA ptah-cli row's id. When set, cli is ignored.
modelRaw model id. For a ptah-cli lane it overrides the tier mapping. Read ids from that lane's own model list; never invent one.
modelTieropus / sonnet / haiku, ptah-cli lanes only; the provider maps the tier to a model.
roleName of a role generated for this workspace. ptah_agent_list lists the valid names. The spawn result reports roleDelivery and roleChannel.
workingDirectoryInside the workspace. A worktree path when lanes edit the same files in parallel.
taskFolder, filesWhere the lane writes deliverables; what it should read.
deliverablesThe files the lane MUST write. Relative to taskFolder when set, else to workingDirectory. Pass it whenever the lane owes you a file — it is what makes the completion signal (§4) able to say the work was actually done.
timeoutInactivity window in milliseconds: the lane is stopped after this long with no output. Default one hour, no maximum; 0 disables it. Pass a value well under an hour (20 min, 1200000, is a good default); a lane that needs more than that is too big — split it.
resume_session_idOnly per §5.

A user-pinned spawn args line (lane, model) is passed through unchanged. ptah_agent_spawn rejects any key not listed here — pass only the documented parameters.

3. Task contract

A lane shares none of your context and cannot ask the user anything. Every task carries:

  1. Objective and acceptance criteria, restated in full.
  2. Inputs as absolute paths (prior artifacts, files, conventions to follow).
  3. Scope: files it may touch; "do not modify anything else".
  4. Deliverable: **Deliverable**: <absolute path> — write the output there with a file tool. Pass the same path in the deliverables parameter; the lane is then told to write it AND the completion signal checks it. When the workflow reads the answer with ptah_agent_read instead (a panel answer), give the exact answer structure in place of a path.
  5. Reply: WROTE: <absolute path> plus a one-line headline, nothing else — when there is a deliverable file.
  6. Report before exiting: call ptah_agent_report once before the final message, naming what was produced, the absolute path of every file written, and anything it could not do. A lane that exits silently still produces a completion signal, but the signal lists files — only the lane can say what it decided and what it left undone.
  7. Git: never commit, push or run history-changing git — unless the workflow gives the lane its own throwaway worktree and says so. Never run git commands that discard working-tree changes (restore, checkout -- <path>, stash, reset, clean); a change the lane did not make belongs to another writer — report it, never revert it.
  8. Blocked: if it cannot proceed, write the blocking questions under ## Clarifications Needed in the deliverable and stop.
  9. Preserve list: when replacing, consolidating or deleting an existing surface, list what it can do today (or pass parity-inventory.md in files). Every item stays, moves, or is listed under ## Proposed Removals for user approval — never removed silently.

Say the output format ("markdown table", "numbered defects with file:line"). A lane that is not told where to write dumps its answer into the reply and skips the file.

When the work calls for a role, pass it as the role parameter — never paste a role template into task. Spawning without role is valid when the workspace has no roles generated.

4. Run

spawn   ptah_agent_spawn({ task, deliverables, cli | ptahCliId, … })  → agentId
wait    <agent-lane-completed> arrives in this session when the lane ends
read    ptah_agent_read({ agentId })                     then Read the deliverable file
stop    ptah_agent_stop({ agentId })                     for a lane you no longer need

Do not poll in a loop. When a lane reaches a terminal status, Ptah pushes one <agent-lane-completed> turn into the session that spawned it. Spawn, get on with your own work, and act when it arrives. The signal carries the agent id, the lane, the terminal status, the exit code, the duration, the number of reports the lane sent, the CLI Session ID when there is one, and one line per declared deliverable.

Act on its verdict, never on the exit code alone:

verdictMeaningDo this
deliveredTerminal status completed and every declared deliverable exists and is non-emptyRead the files and verify the content (§6)
no-deliverableExited cleanly WITHOUT writing every declared deliverableTreat the task as not done. Read the output, then resume per §5 naming the missing paths. Never report the lane as complete
failedTerminal status failed, timeout or stoppedRecover per §5
unverifiedCompleted, but nothing was declared, so nothing was checkedRead the output and verify it. Declare deliverables next time

The <agent-lane-completed> signal is the primary wake; status checks are the fallback. If you must check, make one ptah_agent_status({ agentId }) call, then wait at least 60 s before the next — at most 5 checks per lane, never a loop. Use it and ptah_agent_read({ agentId }) when:

  • no signal arrived — the signal is refused when the spawning session is no longer live, when the lane was spawned with no parent session, or when this host registered no chat runtime;
  • the lane's adapter reports nothing useful, so the output is the only account of what it did (opencode has no messaging support at all);
  • the verdict is anything other than delivered — the signal says WHETHER a file was written, and the output says how far the lane got.

Status is one of running, completed, failed, timeout, stopped.

  • Concurrency: at most 3 lanes in flight by default. Wider only when the workflow allows it and the user agreed to the added cost. Queue the rest and spawn as slots free.
  • Parallel lanes must be independent and file-disjoint, or each gets its own worktree.

5. Recover

Resume only when ptah_agent_status reports a CLI Session ID. Then spawn again on the same lane (cli or ptahCliId) with resume_session_id: <that id> and a continuation task ("Continue the previous task. Also fix: …"). The resumed lane gets a new agentId and the old conversation. No session id → that adapter is ephemeral: respawn with the context restated in task.

SituationAction
timeout, or failed / stopped with partial workResume if possible, else respawn with a smaller task
verdict: no-deliverableResume naming every missing path, and say the file was never written
Completed but missed itemsResume and name what was missed
Wrong approach or useless outputRespawn with a sharper prompt, or do it yourself
Same lane fails twiceDrop it (say so in the summary) and reassign its work to another lane
No lane available at allDo the work in-process and label it as not an outside lane

6. Verify and revise

Lane output is evidence, not proof.

OutputBefore you use it
Research, surveys, summariesSpot-check claims against the code
Scaffolding, stubsRead it in full — only the files the lane edited
Decision artifacts (spec, design, plan)A proposal, not a decision. Diff every rule against the user's request; tag rules user-requested / project-rule / lane-proposed, and list only lane-proposed rules under ## Lane-introduced constraints. Project rules keep their project-rule tag and cite their source where they appear; do not list them as lane-introduced. A cross-side review (below) runs first; then the user approves the artifact at orchestration Gate 1, 1.7 or 2 before any lane builds from it.
Code that deletes, replaces or consolidates a surfaceCheck the supplied preserve list or parity-inventory.md item by item; a missing, unapproved capability blocks the batch. Proposed removals require explicit user approval before the batch is accepted.
UI codeTypecheck/test/lint are not proof. Require visual-reviewer screenshots in dark + light themes, compared with the approved prototype (or — for a UI change with no added/redesigned surface and so no prototype — before/after screenshots of the affected screen, the "before" taken from the base commit before the fix lands) and shown to the user before merge.
Code that will shipIndependent review routed cross-side (below), recorded in code-logic-review.md under the code-review role's own verdict contract. Write-path trace: when persisted settings/config/storage writes change, trace each write to its runtime reader (key, scope, value format, side effects such as env vars); confirm behaviour is unchanged or intended.
  • Independence: the author never reviews its own work. Same-family review is allowed when the user asks for it or when the fallback below is necessary; label it weaker evidence.
  • Cross-side review: side is the execution mode — in-process (orchestrator or subagent) or CLI lane; family is the model family. A different CLI family is still the same side. The orchestrator assigns the reviewer: in-process author → a CLI lane; CLI author → a subagent. Opposite side unavailable, lanes disabled at Gate 0.1, or the user explicitly pins a same-side reviewer → an independent reviewer on that side, reason disclosed; prefer another family unless one is pinned. Never silently replace a pinned reviewer. No independent reviewer can run → report the blocker; never claim a review. Applies to every decision artifact (task-description.md, design-spec.md + prototype/, implementation-plan.md) and all shipping code. Document reviews write <artifact-stem>-review.md (APPROVED / REVISE); code reviews keep code-logic-review.md, and an existing eligible review is not duplicated. Invocation and the review protocol: orchestration agent-catalog.md and checkpoints.md. The review informs the user's gate and never replaces it.
  • Defects go back to the original lane (resume per §5) as a numbered list, each with file:line. Drop any defect without a location before relaying it.
  • Revise cap: at most 2 revise rounds (author/reviewer revision pairs) after the initial review; announce it first. At exhaustion, a document goes to its user gate with every open item. For code, report the open defects or make ONE bounded correction, then have the changed code independently reviewed; if that review finds defects, report them and stop — never reset the cap or claim completion.
  • Code checks are the project's typecheck, tests and lint; UI also needs rendered evidence. A lane's PASS is an opinion; run them — scoped to the projects the lane changed (npx nx run-many -t typecheck,test,lint -p <project>), never workspace-wide. Tail or filter the output; never paste a full log into the thread.

7. Talk to a live lane

ptah_agent_message({ agentId, message }) reports how it was delivered. Always branch on mode:

modeMeaning
steerInjected into the turn in flight
queue-next-turnHeld and delivered as the next turn
interrupt-resumeThe turn in flight was aborted and its partial work discarded
unsupportedNothing delivered; detail says why — fall back to §5

ptah_agent_list shows each lane's declared messaging: capability, probed per run rather than fixed per vendor — read it each time. Do not interrupt a lane mid-edit to add a minor note. On a ptah-cli lane the message is echoed into that lane's own output, which is how you confirm it arrived. A lane's ptah_agent_report can return delivered: false; a report is attribution, not authentication — verify its claims against files and tests. The same rule applies to the completion signal: it is evidence a file exists, never evidence the content is right.

The lane does not need to be told any of this in its task: buildTaskPrompt (libs/backend/cli-agent-runtime/src/lib/cli-agents/cli-adapters/cli-adapter.utils.ts, TWO_WAY_MESSAGING_GUIDANCE) already carries the child-side half on every spawn that has an MCP port and an agent id, and renderLaneCompletionContract (libs/backend/cli-agent-runtime/src/lib/cli-agents/lane-reporting-contract.ts) carries the before-you-exit half on every lane. Those two constants are the source of truth; this section and the parent-side tool table in ptah-system-prompt.constant.ts must agree with them.

8. Cost

Every spawn, resume, message turn and review round is a real paid call. Before spending, announce the lanes, the number of rounds and the resulting call count — including required document reviews: one initial review per artifact plus up to two author/reviewer pairs.

Inside a lane, cost ≈ requests × context: every tool call is one request that resends the whole thread, so a lane's bill grows with its call count times its accumulated context. Measured over 7 days of Codex lanes: 68 requests per session at an average 115k-token context, 29% of them polling, and 1.23 billion input tokens in total.

  • Default ceiling: 40 tool calls per lane. State it in task; a lane near it reports and stops.
  • Give the lane its file list up front (files plus absolute paths in task) so it edits instead of exploring. Exploration is the calls you pay for twice — once to search, once as context.
  • A lane whose context balloons from a log or a whole-file read pays that context on every call after; the scoped-verification and tail rules in §6 apply inside the lane too.

9. Agent sessions (ptah_session_*)

A child session is a chat session in its own git worktree on a new branch. It opens as a tab in the user's window, and the user can read and type in that tab as well. It is not a CLI lane: it has no process to resume (§5), and it never exits, it goes idle. Use a lane for a bounded task on a vendor CLI; use a child session when the work needs the full chat runtime, slash commands such as /orchestrate TASK_…, or a branch the user can open and review.

ToolUse
ptah_session_start({ task, branch, … })Create the worktree and branch, open the tab, run task
ptah_session_send({ sessionId, message, mode? })Steer. queue (default), steer (interrupts the turn in flight), if-idle (refused as busy otherwise)
ptah_session_status({ sessionId? })State of one or all of your children
ptah_session_read({ sessionId, tailKiB? })Tail of the child's transcript (default 32 KiB, max 256)
ptah_session_stop({ sessionId })Stop it; tab, transcript, worktree and branch remain
  • Messaging first. Steer with ptah_session_send; use ptah_session_read to inspect. Do not poll ptah_session_status while a completion turn is due: one is pushed into your session each time a child settles, as <agent-lane-completed … cli="ptah-session" …>, with a verdict of delivered, no-deliverable, unverified or failed. Verify the deliverables yourself; a file existing is not proof its content is right.
  • Call ptah_session_status after a resume. Children keep running while you are not live and a completion that arrived then is held, not lost. Every ptah_session_* result ends with those held completions under "Held while this session was not live". A child's ptah_agent_report while you are not live is refused and counted, not queued.
  • Permissions. There is no permission, path or parent argument. File edits inside the worktree and allowlisted Bash commands run without asking; anything else waits in the child's tab for the user, then is denied (ptah_session_status shows awaiting-permission with the denial time).
  • Limits. At most 3 live children per host by default, depth 1 (a child cannot start sessions). An idle child still holds its slot until ptah_session_stop. A refusal is returned as text with a code (cap-reached, depth-exceeded, branch-exists, …); act on it, do not retry blindly.
  • The user owns the result. The worktree and the branch remain after the child ends. Never merge, push or clean up on the user's behalf.
  • Hosts. Child sessions need the chat runtime and the Ptah MCP server. In a host without the session spawner the tools fail with an error that says so.
  • Reports. A child reports with ptah_agent_report; it arrives as <agent-report … cli="ptah-session">, the same envelope a lane's report uses.

Settings, limits and the full tool reference: the "Agent Sessions" page in the Ptah docs.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.