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
- lammersbjorn/sane-nexttheir own version, first seen May 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- lammersbjorn/sane-next★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository25 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- angular-3d-scene-crafterSkill
- angular-frontend-patternsSkill
- angular-gsap-animation-crafterSkill
- ddd-architectureSkill
- execute-phase-gated-taskSkill
- extract-and-relocate-angular-component-featureSkill
- fleet-orchestrationSkill
- humanize-librarySkill
- impeccableSkill
- nestjs-backend-patternsSkill
- nestjs-deploymentSkill
- nx-workspace-architectSkill
- orchestrationSkill
- ptah-cli-usageSkill
- resilient-nestjs-patternsSkill
- saas-platform-patternsSkill
- saas-workspace-initializerSkill
- skill-creatorSkill
- technical-content-writerSkill
- tribunalSkill
- typesafe-aiSkill
- ui-ux-designerSkill
- video-showcaseSkill
- webhook-architectureSkill
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
- Very specific: line 67
Report before exiting: call ptah_agent_report once before the final message, naming what was produced, the absolute path of every file …
- Very specific: line 71
Git: never commit, push or run history-changing git — unless the workflow gives the lane its own throwaway worktree and says so.
- Very specific: line 75
Blocked: if it cannot proceed, write the blocking questions under ## Clarifications Needed in the deliverable and stop.
- Very specific: line 77
Preserve list: when replacing, consolidating or deleting an existing surface, list what it can do today (or pass parity-inventory.md in …
- Very specific: line 84
When the work calls for a role, pass it as the role parameter — never paste a role template into task.
- Very specific: line 96
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.
- Distinctive: line 115
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 …
- Very specific: line 133
No session id → that adapter is ephemeral: respawn with the context restated in task.
- Distinctive: line 210
Every spawn, resume, message turn and review round is a real paid call.
- Very specific: line 219
Default ceiling: 40 tool calls per lane.
≈ “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.
Files
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 withcli. Any other status (not installed,disabled) → skip.Type: ptah-cli+available→ spawnable withptahCliId.- Family = the
clivalue, or theprovider: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
| Param | Use |
task | Required. The self-contained prompt (§3). |
cli | A system CLI from an installed row. Omit for the user's default CLI. |
ptahCliId | A ptah-cli row's id. When set, cli is ignored. |
model | Raw model id. For a ptah-cli lane it overrides the tier mapping. Read ids from that lane's own model list; never invent one. |
modelTier | opus / sonnet / haiku, ptah-cli lanes only; the provider maps the tier to a model. |
role | Name of a role generated for this workspace. ptah_agent_list lists the valid names. The spawn result reports roleDelivery and roleChannel. |
workingDirectory | Inside the workspace. A worktree path when lanes edit the same files in parallel. |
taskFolder, files | Where the lane writes deliverables; what it should read. |
deliverables | The 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. |
timeout | Inactivity 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_id | Only 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:
- Objective and acceptance criteria, restated in full.
- Inputs as absolute paths (prior artifacts, files, conventions to follow).
- Scope: files it may touch; "do not modify anything else".
- Deliverable:
**Deliverable**: <absolute path>— write the output there with a file tool. Pass the same path in thedeliverablesparameter; the lane is then told to write it AND the completion signal checks it. When the workflow reads the answer withptah_agent_readinstead (a panel answer), give the exact answer structure in place of a path. - Reply:
WROTE: <absolute path>plus a one-line headline, nothing else — when there is a deliverable file. - Report before exiting: call
ptah_agent_reportonce 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. - 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. - Blocked: if it cannot proceed, write the blocking questions under
## Clarifications Neededin the deliverable and stop. - Preserve list: when replacing, consolidating or deleting an existing surface, list what it
can do today (or pass
parity-inventory.mdinfiles). Every item stays, moves, or is listed under## Proposed Removalsfor 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 needDo 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:
verdict | Meaning | Do this |
delivered | Terminal status completed and every declared deliverable exists and is non-empty | Read the files and verify the content (§6) |
no-deliverable | Exited cleanly WITHOUT writing every declared deliverable | Treat the task as not done. Read the output, then resume per §5 naming the missing paths. Never report the lane as complete |
failed | Terminal status failed, timeout or stopped | Recover per §5 |
unverified | Completed, but nothing was declared, so nothing was checked | Read 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
(
opencodehas 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.
| Situation | Action |
timeout, or failed / stopped with partial work | Resume if possible, else respawn with a smaller task |
verdict: no-deliverable | Resume naming every missing path, and say the file was never written |
| Completed but missed items | Resume and name what was missed |
| Wrong approach or useless output | Respawn with a sharper prompt, or do it yourself |
| Same lane fails twice | Drop it (say so in the summary) and reassign its work to another lane |
| No lane available at all | Do the work in-process and label it as not an outside lane |
6. Verify and revise
Lane output is evidence, not proof.
| Output | Before you use it |
| Research, surveys, summaries | Spot-check claims against the code |
| Scaffolding, stubs | Read 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 surface | Check 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 code | Typecheck/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 ship | Independent 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 keepcode-logic-review.md, and an existing eligible review is not duplicated. Invocation and the review protocol: orchestrationagent-catalog.mdandcheckpoints.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
PASSis 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:
mode | Meaning |
steer | Injected into the turn in flight |
queue-next-turn | Held and delivered as the next turn |
interrupt-resume | The turn in flight was aborted and its partial work discarded |
unsupported | Nothing 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 (
filesplus absolute paths intask) 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.
| Tool | Use |
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; useptah_session_readto inspect. Do not pollptah_session_statuswhile a completion turn is due: one is pushed into your session each time a child settles, as<agent-lane-completed … cli="ptah-session" …>, with averdictofdelivered,no-deliverable,unverifiedorfailed. Verify the deliverables yourself; a file existing is not proof its content is right. - Call
ptah_session_statusafter a resume. Children keep running while you are not live and a completion that arrived then is held, not lost. Everyptah_session_*result ends with those held completions under "Held while this session was not live". A child'sptah_agent_reportwhile 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_statusshowsawaiting-permissionwith 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.
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
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.

