dsh-pstack 0.2.0-beta.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -3
- package/README.md +148 -84
- package/README.zh.md +198 -0
- package/assets/pstack-config-entry.png +0 -0
- package/cordis.patch.yml +105 -27
- package/dist/client.mjs +2341 -0
- package/dist/client.mjs.map +1 -0
- package/dist/host-contract-CUPSpeNk.d.mts +22 -0
- package/dist/index.d.mts +49 -238
- package/dist/index.mjs +250 -123
- package/dist/models.d.mts +44 -0
- package/dist/models.mjs +201 -0
- package/dist/paths-BT77khwm.mjs +48 -0
- package/dist/pstack/LICENSE +21 -0
- package/dist/pstack/README.md +291 -0
- package/dist/pstack/agents/poteto-agent.md +9 -0
- package/{assets → dist/pstack}/docs/guide/01-setup.md +13 -11
- package/{assets → dist/pstack}/docs/guide/02-poteto-mode.md +4 -4
- package/{assets → dist/pstack}/docs/guide/04-design.md +4 -4
- package/{assets → dist/pstack}/docs/guide/05-build-and-clean.md +2 -2
- package/{assets → dist/pstack}/docs/guide/06-verify-and-ship.md +13 -3
- package/{assets → dist/pstack}/docs/guide/07-overnight.md +15 -13
- package/{assets → dist/pstack}/docs/guide/09-make-it-yours.md +6 -2
- package/{assets → dist/pstack}/docs/guide/10-recipes-and-pitfalls.md +7 -5
- package/{assets → dist/pstack}/docs/guide/README.md +1 -1
- package/dist/pstack/docs/harness/dsh.md +98 -0
- package/{assets → dist/pstack}/skills/architect/SKILL.md +12 -12
- package/dist/pstack/skills/arena/SKILL.md +50 -0
- package/{assets → dist/pstack}/skills/automate-me/SKILL.md +14 -14
- package/{assets → dist/pstack}/skills/benchmark-checklist/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/blast-radius/SKILL.md +4 -6
- package/{assets → dist/pstack}/skills/correct/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/create-formal-verification-skill/SKILL.md +4 -2
- package/{assets → dist/pstack}/skills/create-verification-skill/SKILL.md +5 -5
- package/dist/pstack/skills/figure-it-out/SKILL.md +54 -0
- package/dist/pstack/skills/how/SKILL.md +38 -0
- package/{assets → dist/pstack}/skills/in-your-own-words/SKILL.md +1 -1
- package/dist/pstack/skills/interrogate/SKILL.md +33 -0
- package/{assets → dist/pstack}/skills/ketchup/SKILL.md +3 -5
- package/dist/pstack/skills/ketchup-video/SKILL.md +29 -0
- package/{assets → dist/pstack}/skills/maintain-formal-verification-skill/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/maintain-verification-skill/SKILL.md +3 -3
- package/dist/pstack/skills/make-bot-ui/SKILL.md +117 -0
- package/dist/pstack/skills/no-comments/SKILL.md +26 -0
- package/{assets → dist/pstack}/skills/poteto-help/SKILL.md +34 -31
- package/{assets → dist/pstack}/skills/poteto-help/references/prompting.md +1 -1
- package/{assets → dist/pstack}/skills/poteto-help/references/recipes.md +3 -3
- package/{assets → dist/pstack}/skills/poteto-mode/SKILL.md +20 -19
- package/dist/pstack/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
- package/dist/pstack/skills/poteto-mode/playbooks/autonomous-run.md +13 -0
- package/dist/pstack/skills/poteto-mode/playbooks/autopilot-full.md +25 -0
- package/dist/pstack/skills/poteto-mode/playbooks/autopilot-stack.md +8 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/babysit.md +4 -4
- package/dist/pstack/skills/poteto-mode/playbooks/bug-fix.md +15 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/eval.md +3 -3
- package/dist/pstack/skills/poteto-mode/playbooks/feature.md +21 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/hillclimb.md +3 -3
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/investigation.md +2 -2
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/multi-phase-plan.md +23 -23
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/opening-a-pr.md +6 -6
- package/dist/pstack/skills/poteto-mode/playbooks/orchestrate.md +25 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/pause-safely.md +2 -2
- package/dist/pstack/skills/poteto-mode/playbooks/perf-issue.md +25 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/prototype.md +4 -4
- package/dist/pstack/skills/poteto-mode/playbooks/refactoring.md +16 -0
- package/dist/pstack/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
- package/dist/pstack/skills/poteto-mode/playbooks/session-pickup.md +11 -0
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/shipping.md +2 -2
- package/{assets → dist/pstack}/skills/poteto-mode/playbooks/trace-forensics.md +2 -2
- package/dist/pstack/skills/poteto-mode/playbooks/visual-parity.md +11 -0
- package/dist/pstack/skills/poteto-mode/playbooks/worktree-cleanup.md +12 -0
- package/{assets → dist/pstack}/skills/poteto-mode/scripts/check-plan.mjs +6 -8
- package/dist/pstack/skills/poteto-mode/scripts/check-plan.test.mjs +128 -0
- package/{assets/skills/poteto-mode/scripts/check-plan.test.mjs → dist/pstack/skills/poteto-mode/scripts/expect.mjs} +12 -101
- package/dist/pstack/skills/poteto-mode/scripts/support.mjs +93 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.mjs +123 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +217 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.mjs +119 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.mjs +626 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/github.test.mjs +521 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.mjs +657 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +523 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/render.mjs +106 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/types.mjs +9 -0
- package/dist/pstack/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +5 -0
- package/{assets → dist/pstack}/skills/poteto-mode/scripts/worktree-audit.mjs +15 -22
- package/dist/pstack/skills/poteto-mode/scripts/worktree-audit.test.mjs +134 -0
- package/{assets → dist/pstack}/skills/principle-attack-the-premise/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-boundary-discipline/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-encode-lessons-in-structure/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-exhaust-the-design-space/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-experience-first/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-explain-the-number/SKILL.md +3 -2
- package/{assets → dist/pstack}/skills/principle-fix-root-causes/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-laziness-protocol/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-make-operations-idempotent/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-minimize-reader-load/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-model-the-domain/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-never-block-on-the-human/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-outcome-oriented-execution/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-prove-it-works/SKILL.md +2 -2
- package/{assets → dist/pstack}/skills/principle-redesign-from-first-principles/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-separate-before-serializing-shared-state/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-sequence-verifiable-units/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-subtract-before-you-add/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-test-behavior-not-implementation/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/principle-type-system-discipline/SKILL.md +1 -1
- package/dist/pstack/skills/recall/SKILL.md +37 -0
- package/dist/pstack/skills/reflect/SKILL.md +71 -0
- package/{assets → dist/pstack}/skills/reflect/references/divergent-reviewer.md +4 -4
- package/{assets → dist/pstack}/skills/reflect/references/judgment-reviewer.md +2 -2
- package/{assets → dist/pstack}/skills/reflect/references/synthesizer.md +5 -5
- package/{assets → dist/pstack}/skills/reflect/references/tooling-reviewer.md +2 -2
- package/dist/pstack/skills/setup-pstack/SKILL.md +80 -0
- package/{assets → dist/pstack}/skills/sharpen/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/show-me-your-work/SKILL.md +8 -8
- package/{assets → dist/pstack}/skills/show-me-your-work/scripts/log.mjs +1 -3
- package/dist/pstack/skills/show-me-your-work/scripts/log.test.mjs +56 -0
- package/dist/pstack/skills/statechart/SKILL.md +82 -0
- package/dist/pstack/skills/statechart/references/render.md +93 -0
- package/dist/pstack/skills/statechart/scripts/backends/cfg.mjs +31 -0
- package/dist/pstack/skills/statechart/scripts/backends/mermaid.mjs +186 -0
- package/dist/pstack/skills/statechart/scripts/backends/plain-text.mjs +62 -0
- package/dist/pstack/skills/statechart/scripts/backends/report.mjs +84 -0
- package/dist/pstack/skills/statechart/scripts/frontends/config.mjs +268 -0
- package/dist/pstack/skills/statechart/scripts/frontends/dot.mjs +67 -0
- package/dist/pstack/skills/statechart/scripts/frontends/marks.mjs +94 -0
- package/dist/pstack/skills/statechart/scripts/frontends/messages.mjs +48 -0
- package/dist/pstack/skills/statechart/scripts/frontends/spec.mjs +101 -0
- package/dist/pstack/skills/statechart/scripts/frontends/trace.mjs +39 -0
- package/dist/pstack/skills/statechart/scripts/frontends/value.mjs +180 -0
- package/dist/pstack/skills/statechart/scripts/frontends/verdict.mjs +40 -0
- package/dist/pstack/skills/statechart/scripts/frontends/view.mjs +99 -0
- package/dist/pstack/skills/statechart/scripts/ir.mjs +277 -0
- package/dist/pstack/skills/statechart/scripts/passes/annotate.mjs +92 -0
- package/dist/pstack/skills/statechart/scripts/passes/label.mjs +210 -0
- package/dist/pstack/skills/statechart/scripts/passes/lift.mjs +84 -0
- package/dist/pstack/skills/statechart/scripts/passes/loop-check.mjs +47 -0
- package/dist/pstack/skills/statechart/scripts/passes/paths.mjs +72 -0
- package/dist/pstack/skills/statechart/scripts/passes/reach.mjs +135 -0
- package/dist/pstack/skills/statechart/scripts/passes/region-check.mjs +82 -0
- package/dist/pstack/skills/statechart/scripts/passes/regions.mjs +268 -0
- package/dist/pstack/skills/statechart/scripts/pipeline.mjs +72 -0
- package/dist/pstack/skills/statechart/scripts/run.mjs +440 -0
- package/dist/pstack/skills/statechart/scripts/statechart.mjs +155 -0
- package/dist/pstack/skills/statechart/scripts/statechart.test.mjs +198 -0
- package/dist/pstack/skills/statechart/scripts/worker.mjs +31 -0
- package/dist/pstack/skills/swarm/SKILL.md +43 -0
- package/{assets → dist/pstack}/skills/tdd/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/teach/SKILL.md +2 -2
- package/{assets → dist/pstack}/skills/technical-writing/SKILL.md +1 -1
- package/{assets → dist/pstack}/skills/typescript-best-practices/SKILL.md +3 -6
- package/{assets → dist/pstack}/skills/why/SKILL.md +8 -8
- package/dist/remote.d.mts +27 -0
- package/dist/remote.mjs +234 -0
- package/dist/role-config-NNn5r1JX.mjs +415 -0
- package/dist/role-manifest-C3fUzjLI.d.mts +19 -0
- package/dist/role-wire-DZwTn2wF.d.mts +55 -0
- package/dist/roles.d.mts +18 -0
- package/dist/roles.mjs +323 -0
- package/dist/script.d.mts +9 -111
- package/dist/script.mjs +32 -329
- package/dist/skill.d.mts +38 -0
- package/dist/skill.mjs +183 -0
- package/dist/skills/authored/decision-audit/SKILL.md +103 -0
- package/dist/skills/authored/decision-audit/SKILL.zh.md +103 -0
- package/dist/skills/authored/decision-audit/references/recover-commit.md +17 -0
- package/dist/skills/authored/decision-audit/references/recover-commit.zh.md +17 -0
- package/dist/skills/authored/decision-write/SKILL.md +133 -0
- package/dist/skills/authored/decision-write/SKILL.zh.md +133 -0
- package/dist/skills/authored/decision-write/references/land.md +48 -0
- package/dist/skills/authored/decision-write/references/land.zh.md +48 -0
- package/dist/skills/authored/decision-write/references/scope.md +16 -0
- package/dist/skills/authored/decision-write/references/scope.zh.md +16 -0
- package/dist/skills/authored/docs-drift/SKILL.md +120 -0
- package/dist/skills/authored/docs-drift/SKILL.zh.md +120 -0
- package/dist/skills/authored/setup-project-docs/SKILL.md +63 -0
- package/dist/skills/authored/setup-project-docs/SKILL.zh.md +63 -0
- package/dist/skills/authored/setup-project-docs/references/decision-conventions.md +13 -0
- package/dist/skills/authored/setup-project-docs/references/decision-conventions.zh.md +13 -0
- package/dist/skills/vendored/retro/SKILL.md +44 -0
- package/dist/skills/vendored/retro/agents/openai.yaml +5 -0
- package/dist/skills/vendored/writing-for-agents/SKILL-MECHANICS.md +22 -0
- package/dist/skills/vendored/writing-for-agents/SKILL.md +81 -0
- package/dist/skills/vendored/writing-for-agents/agents/openai.yaml +3 -0
- package/dist/subagent.d.mts +54 -206
- package/dist/subagent.mjs +258 -963
- package/locale/en.json +3 -2
- package/locale/zh.json +3 -2
- package/package.json +93 -66
- package/assets/agents/poteto-agent.md +0 -8
- package/assets/docs/harness/dsh.md +0 -60
- package/assets/docs/pstack-models.example.md +0 -54
- package/assets/skills/arena/SKILL.md +0 -50
- package/assets/skills/figure-it-out/SKILL.md +0 -54
- package/assets/skills/how/SKILL.md +0 -38
- package/assets/skills/interrogate/SKILL.md +0 -71
- package/assets/skills/interrogate/references/code-quality-review.md +0 -47
- package/assets/skills/interrogate/references/lead-judgment.md +0 -39
- package/assets/skills/interrogate/references/reviewer-prompt.md +0 -62
- package/assets/skills/interrogate/references/rubric.md +0 -77
- package/assets/skills/no-comments/SKILL.md +0 -26
- package/assets/skills/poteto-mode/playbooks/authoring-a-skill.md +0 -12
- package/assets/skills/poteto-mode/playbooks/autonomous-run.md +0 -15
- package/assets/skills/poteto-mode/playbooks/autopilot-full.md +0 -25
- package/assets/skills/poteto-mode/playbooks/autopilot-stack.md +0 -12
- package/assets/skills/poteto-mode/playbooks/bug-fix.md +0 -15
- package/assets/skills/poteto-mode/playbooks/feature.md +0 -21
- package/assets/skills/poteto-mode/playbooks/orchestrate.md +0 -112
- package/assets/skills/poteto-mode/playbooks/perf-issue.md +0 -25
- package/assets/skills/poteto-mode/playbooks/refactoring.md +0 -16
- package/assets/skills/poteto-mode/playbooks/runtime-forensics.md +0 -11
- package/assets/skills/poteto-mode/playbooks/session-pickup.md +0 -11
- package/assets/skills/poteto-mode/playbooks/visual-parity.md +0 -11
- package/assets/skills/poteto-mode/playbooks/worktree-cleanup.md +0 -20
- package/assets/skills/poteto-mode/scripts/orch/orch.mjs +0 -4282
- package/assets/skills/poteto-mode/scripts/orch/orch.test.mjs +0 -2042
- package/assets/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +0 -5101
- package/assets/skills/poteto-mode/scripts/watch-pr/github.test.mjs +0 -1177
- package/assets/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +0 -1441
- package/assets/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +0 -4601
- package/assets/skills/recall/SKILL.md +0 -37
- package/assets/skills/reflect/SKILL.md +0 -69
- package/assets/skills/setup-pstack/SKILL.md +0 -67
- package/assets/skills/swarm/SKILL.md +0 -43
- package/dist/frontmatter-BQX3ekwP.mjs +0 -229
- package/dist/frontmatter-BQX3ekwP.mjs.map +0 -1
- package/dist/history.d.mts +0 -429
- package/dist/history.mjs +0 -1129
- package/dist/history.mjs.map +0 -1
- package/dist/host-contract-o47JH_r8.d.mts +0 -527
- package/dist/index.mjs.map +0 -1
- package/dist/paths-D_JlVmBk.mjs +0 -42
- package/dist/paths-D_JlVmBk.mjs.map +0 -1
- package/dist/script.mjs.map +0 -1
- package/dist/subagent.mjs.map +0 -1
- /package/{static/icon.png → assets/logo.png} +0 -0
- /package/{assets → dist/pstack}/agents/comment-sicko.md +0 -0
- /package/{assets → dist/pstack}/docs/guide/03-understand.md +0 -0
- /package/{assets → dist/pstack}/docs/guide/08-principles.md +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/design.jpg +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/overnight.jpg +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/recipes.jpg +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/router.jpg +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/understanding.jpg +0 -0
- /package/{assets → dist/pstack}/docs/guide/images/verification.jpg +0 -0
- /package/{assets → dist/pstack}/skills/architect/references/design-red-flags.md +0 -0
- /package/{assets → dist/pstack}/skills/architect/references/rationale-template.md +0 -0
- /package/{assets → dist/pstack}/skills/architect/references/runner-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/bro/SKILL.md +0 -0
- /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/README.md +0 -0
- /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/create-note.md +0 -0
- /package/{assets → dist/pstack}/skills/create-verification-skill/references/feature-map-example/search.md +0 -0
- /package/{assets → dist/pstack}/skills/how/references/explainer-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/how/references/explorer-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/poteto-mode/references/bugbot-triage.md +0 -0
- /package/{assets → dist/pstack}/skills/principle-build-the-lever/SKILL.md +0 -0
- /package/{assets → dist/pstack}/skills/principle-foundational-thinking/SKILL.md +0 -0
- /package/{assets → dist/pstack}/skills/principle-guard-the-context-window/SKILL.md +0 -0
- /package/{assets → dist/pstack}/skills/show-me-your-work/references/decision-log-template.tsv +0 -0
- /package/{assets → dist/pstack}/skills/typescript-best-practices/references/patterns.md +0 -0
- /package/{assets → dist/pstack}/skills/unslop/SKILL.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/epistemics.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/investigator-prompt.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/source-playbook.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/code-archaeology.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/databricks.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/datadog.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/incident-postmortem.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/linear.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/notion.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/sentry.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/sources/slack.md +0 -0
- /package/{assets → dist/pstack}/skills/why/references/synthesizer-prompt.md +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Decision-record conventions
|
|
2
|
+
|
|
3
|
+
When decision records are enabled, draft `<dir>/AGENTS.md` as the repository's authoritative format, scope, status, and search reference. Include:
|
|
4
|
+
|
|
5
|
+
- The five-field header: `Status`, `Date`, `Scope`, `Implemented-by`, `Review`.
|
|
6
|
+
- The status/anchor pair rule and transitions, including immediate supersession by a new draft. A replaced `proposed` record retains `Implemented-by: -`; preserve its body rather than deleting or reverting it.
|
|
7
|
+
- Before starting any repository task, read the headers of every `proposed` and `accepted` record, then select by `Scope` against the task and its affected paths and read the full text of relevant records. `accepted` records constrain current implementation; `proposed` records state the intended direction. When the task conflicts with a relevant record, report the conflict and obtain the user's direction before proceeding.
|
|
8
|
+
- Related-record search and classification before writing or substantially updating a record.
|
|
9
|
+
- `decision-write` as the entry rule for every record change.
|
|
10
|
+
- One `Scope` matcher shared by writing and auditing, including repository-relative paths and directory globs that cover descendants.
|
|
11
|
+
- `Superseded-by` with the replacing record path and one-line reason for every `superseded` record.
|
|
12
|
+
|
|
13
|
+
Adapt `decision-write`'s fallback template to the repository's language and conventions. Require a real implementation anchor to intersect `Scope` and include a path outside `<dir>`. Permit a record-only commit only through `decision-write`'s explicitly confirmed Land exception, and state that audits continue to report it.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 决策记录约定
|
|
2
|
+
|
|
3
|
+
启用决策记录时,起草 `<dir>/AGENTS.md`,作为仓库中格式、范围、状态与检索规则的权威参考。包括:
|
|
4
|
+
|
|
5
|
+
- 五字段头部:`Status`、`Date`、`Scope`、`Implemented-by`、`Review`。
|
|
6
|
+
- 状态/锚点成对规则与状态流转,包括新草稿立即取代旧记录。被取代的 `proposed` 记录保留 `Implemented-by: -`;保留旧正文,不删除、不回退。
|
|
7
|
+
- 开始每项仓库任务前,读取所有 `proposed` 与 `accepted` 记录的头部,再按任务及其涉及的路径与 `Scope` 筛选并读取相关记录的正文。`accepted` 记录约束当前实现;`proposed` 记录表示待落地方向。任务与相关记录冲突时,先报告冲突并取得用户指示,再继续。
|
|
8
|
+
- 写入或实质更新记录前检索并分类相关记录。
|
|
9
|
+
- 以 `decision-write` 作为所有记录修改的入口。
|
|
10
|
+
- 写入与审计共用同一 `Scope` 匹配规则,路径相对于仓库根目录,目录 glob 覆盖所有后代。
|
|
11
|
+
- 每条 `superseded` 记录都带 `Superseded-by`,包含替代记录路径和一句原因。
|
|
12
|
+
|
|
13
|
+
以 `decision-write` 的回退模板为基础,适配仓库的语言与约定。真实实现锚点的路径须与 `Scope` 相交,且至少一个路径在 `<dir>` 之外;仅允许通过 `decision-write` 落地模式中经用户明确确认的例外使用仅记录提交,并写明审计仍会报告该例外。
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: retro
|
|
3
|
+
description: "Conduct a retrospective on a coding session."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The user has asked for a **retrospective**. You are suggesting improvements to the coding agent's **environment** to improve future runs.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
1. Call the Skill tool with `writing-for-agents` for the writing style guide.
|
|
12
|
+
|
|
13
|
+
2. Read the primary sources for the session the user specifies. This may mean searching through session logs on this machine. If the user doesn't specify a session, default to the current one.
|
|
14
|
+
|
|
15
|
+
3. Look for candidates for improvement in these categories.
|
|
16
|
+
|
|
17
|
+
- **Navigation**: how easy was it for the agent to find the right files? Are there hidden dependencies between files? Would a **navigation pointer** make it easier? _Use when_ the session took a long time to find a piece of information.
|
|
18
|
+
- **Automated checks**: are there automated checks that could catch errors the agent made? Linting, typing, tests, filesystem linters? Read the repo's own check command first (its `package.json`/build-tool `lint`/`check` scripts, its CI workflow), so a check that already exists but sits unwired or silently broken is the finding, not a reinvention. A repo with no **guardrail** (no pre-commit hook and no CI job running its lint/typecheck/test command) is itself a finding: an un-linted repo is a standing missed opportunity, not a neutral default. _Use when_ the agent made a mistake an automated check could have caught, or the repo has no guardrail at all.
|
|
19
|
+
- **Coding standards**: should the **reviewer agent** be given a new rule to enforce? Should an existing rule be removed or clarified? Classify the violation first: a **mechanical** one (a fixed syntactic pattern, a banned API, an import shape, a file-location rule) gets a deterministic check, full stop: a custom rule in the repo's own linter, a new pre-commit hook, or a new CI job, whichever the repo's language and existing guardrail make cheapest. Default to building the check over writing the rule. Reserve `CODING_STANDARDS.md` for genuine **judgement calls** (cross-file consistency, "matches the surrounding style," anything no guardrail could ever substitute for). _Use when_ the reviewer agent failed to catch a mistake.
|
|
20
|
+
- **Global AGENTS.md**: are there any steering instructions that should be moved to coding standards (or automated checks) instead? _Use when_ the AGENTS.md file is particularly large - in the repo OR the user's global scope.
|
|
21
|
+
- **Tool economy**: did the agent make expensive tool calls that could be streamlined? Is there any custom tooling (CLI's, MCP's) that is particularly token-inefficient? _Use when_ the agent made an expensive tool call.
|
|
22
|
+
- **No-ops**: look for instructions in steering files that don't modify the agent's behavior. _Use when_ the steering files are large and unwieldy.
|
|
23
|
+
- **Information access**: look for opportunities to increase the agent's access to information. Teeing dev server logs, readonly access to third-party services. _Use when_ a crucial piece of information was not available to the agent.
|
|
24
|
+
|
|
25
|
+
4. Present these candidates to the user, in order of severity.
|
|
26
|
+
|
|
27
|
+
## Reference
|
|
28
|
+
|
|
29
|
+
### Implementation vs Review
|
|
30
|
+
|
|
31
|
+
Remember that all work goes through two stages: implementation and review. The implementation agent has the most **context pressure**. They are responsible for exploration, writing code, and debugging failures.
|
|
32
|
+
|
|
33
|
+
The review agent has the least context pressure - it receives a diff, so no exploration needed. It often does not need to write code or debug.
|
|
34
|
+
|
|
35
|
+
This means that the review agent should be responsible for imposing coding standards, not the implementation agent.
|
|
36
|
+
|
|
37
|
+
### Files
|
|
38
|
+
|
|
39
|
+
You have access to several files in the repo:
|
|
40
|
+
|
|
41
|
+
- `CLAUDE.md`/`AGENTS.md`: these files are pushed to the context window of any agent working in this repo. They should be used incredibly sparingly, usually only for **navigation pointers** to other files.
|
|
42
|
+
- `CODING_STANDARDS.md`: this file is read during review, not implementation. Add **navigation pointers** to docs folders if the standards file gets more than 1,000 lines long.
|
|
43
|
+
- Docs: use docs as references files, pointed to by other files. Look for existing docs before writing new ones.
|
|
44
|
+
- Skills: use skills for docs (since their description goes into the agent's context window), or for user-invoked commands. Follow the advice in the `writing-for-agents` skill.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Skill mechanics
|
|
2
|
+
|
|
3
|
+
The skill-specific branch of [`writing-for-agents`](SKILL.md): what changes when the document is a skill (frontmatter, the invocation choice, and router skills). Everything else about writing it is the universal reference in `SKILL.md`.
|
|
4
|
+
|
|
5
|
+
## Invocation
|
|
6
|
+
|
|
7
|
+
Two choices, trading the two loads:
|
|
8
|
+
|
|
9
|
+
- A **model-invoked** skill keeps a `description`, so the agent can fire it autonomously, and other skills can reach it. You can still type its name: model-invocation always _includes_ user reach; a description only ever adds agent discovery, never removes the human's. The description is the skill's top-level context pointer, forced to stay loaded at all times: permanent context load in exchange for discoverability. A model-invoked skill whose content is all reference is also one home for shared reference: another skill can invoke it, so reference needed by several skills lives in one place. Mechanics: omit `disable-model-invocation`, and write a model-facing description carrying the trigger branches (the pointer-writing rules in `SKILL.md` apply in full).
|
|
10
|
+
- A **user-invoked** skill strips the description from the agent's reach: only the human typing its name can invoke it, and no other skill can. Zero context load, but it spends cognitive load: you are the index that must remember it exists. Mechanics: set `disable-model-invocation: true`; the `description` becomes human-facing: a one-line summary, trigger lists stripped.
|
|
11
|
+
|
|
12
|
+
Pick model-invocation only when the agent must reach the skill on its own, or another skill must. If it only ever fires by hand, make it user-invoked and pay no context load.
|
|
13
|
+
|
|
14
|
+
Shared reference that two user-invoked skills both need can live in neither: with no descriptions, neither can fire the other. Push it to a plain file outside the skill system: external reference any skill can point at.
|
|
15
|
+
|
|
16
|
+
## Splitting by invocation
|
|
17
|
+
|
|
18
|
+
The invocation cut of splitting (the sequence cut lives in `SKILL.md`): split off a model-invoked skill when you have a distinct leading word that should trigger it on its own (a trigger word you actually use in your prompts), or another skill must reach it. You pay context load for the new always-loaded description, so that independent reach has to be worth it.
|
|
19
|
+
|
|
20
|
+
## Router skills
|
|
21
|
+
|
|
22
|
+
When user-invoked skills multiply past what you can remember, that piled-up cognitive load is cured by a **router skill**: one user-invoked skill that names the others and when to reach for each, so the human has one skill to remember instead of many. It can only hint, never fire them: user-invoked skills have no description, so nothing but the human can reach them.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-for-agents
|
|
3
|
+
description: Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Reference for writing any document an agent consumes: a skill, an `AGENTS.md` / `CLAUDE.md`, a doc reached by a pointer. The packaging differs; the writing does not: the same levers make each one predictable, since the agent takes the same _process_ every run rather than producing the same output.
|
|
7
|
+
|
|
8
|
+
When the document you're writing is a skill, read [`SKILL-MECHANICS.md`](SKILL-MECHANICS.md) for frontmatter, invocation choice, and router skills.
|
|
9
|
+
|
|
10
|
+
## Context pointers
|
|
11
|
+
|
|
12
|
+
A **context pointer** is a reference held in the agent's context that names some out-of-context material and encodes the condition for reaching it. A skill's description is one; a line in `AGENTS.md` naming a doc is the same object. The pointer's _wording_, not its target, decides when the agent reaches the material, and how reliably. A must-have target behind a weakly worded pointer is a variance bug: sharpen the wording first, and inline the material only if sharpening fails.
|
|
13
|
+
|
|
14
|
+
A pointer does two jobs: state what the material is, and list the **branches** that should trigger reaching it (a branch is a distinct case the document handles, so different runs take different paths through it). Every word of an always-loaded pointer costs on every turn, so it earns even harder pruning than the body:
|
|
15
|
+
|
|
16
|
+
- **Front-load the leading word**: the pointer is where it does its triggering work.
|
|
17
|
+
- **One trigger per branch.** Synonyms that rename a single branch are one branch written twice; collapse them and keep only genuinely distinct branches.
|
|
18
|
+
- **Cut identity the body already carries.**
|
|
19
|
+
|
|
20
|
+
## The two loads
|
|
21
|
+
|
|
22
|
+
Every document and pointer you add spends one of two budgets:
|
|
23
|
+
|
|
24
|
+
- **Context load** is the cost of always-loaded material on the agent's window: an `AGENTS.md` line, a skill description, anything sitting in context every turn, spending tokens and attention whether or not it fires.
|
|
25
|
+
- **Cognitive load** is the cost on the human: which documents exist and when to reach for each. The human is the index. Not a cost to minimise: it is the price of human agency; spend it where human judgement matters, remove it where it does not.
|
|
26
|
+
|
|
27
|
+
Material reached only through a pointer escapes context load at the price of the pointer's own line; material with no pointer at all rides entirely on cognitive load.
|
|
28
|
+
|
|
29
|
+
## Information hierarchy
|
|
30
|
+
|
|
31
|
+
A document is built from two content types: **steps** (the ordered actions the agent performs) and **reference** (definitions, rules, facts consulted on demand). The two mix freely: all steps (a recipe), all reference (a review's rules, this skill), or both. The core decision is where each piece sits on the **information hierarchy**, a ladder ranked by how immediately the agent needs the material:
|
|
32
|
+
|
|
33
|
+
1. **In-file step** is the primary tier: what the agent does, in order.
|
|
34
|
+
2. **In-file reference** is consulted on demand. Often a legitimately flat peer-set (every rule of a review on one rung), which is a fine arrangement, not a smell.
|
|
35
|
+
3. **Disclosed reference** is pushed out into a separate file, reached by a context pointer, loaded only when the pointer fires. Spans a sibling file in the same folder through fully external reference that lives anywhere and any document can point at.
|
|
36
|
+
|
|
37
|
+
Push too little down and the top bloats; push too much and you hide material the agent actually needs. That tension is the whole decision.
|
|
38
|
+
|
|
39
|
+
**Progressive disclosure** is the move down the ladder (out of the main file and behind a pointer) so the top stays legible. Not primarily a token optimisation: it is how the hierarchy is protected. Branching is the cleanest disclosure test: inline what every branch needs, and push behind a pointer what only some branches reach. When a document has steps, in-file reference that should be disclosed buries them and turns attending to them into a coin-flip: a variance lever, not just a legibility one.
|
|
40
|
+
|
|
41
|
+
**Co-location** is the within-file companion: where the ladder decides _how far down_ a piece sits, co-location decides _what sits beside it_ once there. Keep a concept's definition, rules, and caveats under one heading rather than scattered, so reading one part brings its neighbours with it. The test: the document should read like documentation written for the agent. Grouped material reads that way; scattered material does not. (Distinct from duplication: that repeats one meaning in two places; scattering fragments one meaning across many.)
|
|
42
|
+
|
|
43
|
+
**Sprawl** is the failure mode here: a document simply too long, even when every line is live and unique. Attention thins across the excess, and every extra line is one more to keep relevant. The cure is the ladder: disclose reference behind pointers, and split by branch or sequence so each path carries only what it needs.
|
|
44
|
+
|
|
45
|
+
## Steps and completion criteria
|
|
46
|
+
|
|
47
|
+
Every step ends on a **completion criterion**, the condition that tells the agent the work is done. Two properties make it a lever:
|
|
48
|
+
|
|
49
|
+
- **Clarity**: can the agent tell done from not-done? A vague bound ("understanding reached") invites **premature completion**: ending the step before it is genuinely done, attention slipping to _being done_. The visible steps still ahead (the **post-completion steps**) supply the pull; the criterion's clarity is the resistance. Defend in order: **sharpen the bound first** (local and cheap); only if it is irreducibly fuzzy _and_ you observe the rush, hide the later steps by splitting the sequence. Hiding only works across a real context boundary (a hand-off or a subagent dispatch; an inline call leaves the later steps in context and clears nothing).
|
|
50
|
+
- **Demand**: how much it requires. "Every modified model accounted for" forces thorough work where "produce a change list" does not. Demand drives **legwork** (the digging the agent does within the work, latent in the wording rather than written as its own step), and it is not step-bound: "every rule applied" binds a body of flat reference just as "every step done" binds a sequence, which is how an all-reference document still carries an exhaustiveness bar.
|
|
51
|
+
|
|
52
|
+
The strongest criteria are both checkable and exhaustive.
|
|
53
|
+
|
|
54
|
+
## When to split
|
|
55
|
+
|
|
56
|
+
Splitting one document into two spends one of the two loads, so split only when the cut earns it:
|
|
57
|
+
|
|
58
|
+
- **By sequence**: split a run of steps where the post-completion steps tempt the agent to rush the one in front of it. Keeping them out of view drives more legwork on the current task. Beware the reverse: merging sequences exposes each step's later steps to what follows, inviting premature completion.
|
|
59
|
+
- **By invocation**, skill-specific: see [`SKILL-MECHANICS.md`](SKILL-MECHANICS.md).
|
|
60
|
+
|
|
61
|
+
## Leading words
|
|
62
|
+
|
|
63
|
+
A **leading word** is a compact concept already living in the model's pretraining that the agent thinks with while running the document (_lesson_, _fog of war_, _tracer bullets_). Repeated as a token, never as a sentence, it accumulates a distributed definition and anchors a whole region of behaviour in the fewest tokens, by recruiting priors the model already holds. Coining your own works if you define it clearly, but a made-up word recruits no priors: you pay in definition tokens what a pretrained word gives free; reach for an existing word first.
|
|
64
|
+
|
|
65
|
+
It anchors twice. In the body, _execution_: the agent reaches for the same behaviour every time the word appears, and inside flat reference it focuses attention on a class of thing to look for. In a pointer, _invocation_: when the same word lives in your prompts, your docs, and your codebase, the agent links that shared language to the material and reaches it more reliably.
|
|
66
|
+
|
|
67
|
+
Hunt for opportunities to refactor with leading words. A triad spelled out at three sites, a pointer spending a sentence to gesture at one idea. Each is a passage begging to collapse into a single token:
|
|
68
|
+
|
|
69
|
+
- "fast, deterministic, low-overhead" → _tight_ (a _tight_ loop).
|
|
70
|
+
- "a loop you believe in" → _red_, turning a fuzzy gate into a binary observable state (the loop goes _red_ on the bug, or it doesn't).
|
|
71
|
+
|
|
72
|
+
You win twice: fewer tokens, and a sharper hook for the agent to hang its thinking on. Assume every document is carrying restatements that leading words retire. Go find them.
|
|
73
|
+
|
|
74
|
+
**Negation** is the failure mode beside this lever: steering by prohibition drags the forbidden behaviour into context and makes it _more_ available, not less. _Don't think of an elephant_, and the elephant is all there is; the negation is a weak modifier the strongly-activated concept overruns, so the ban half-reads as an instruction to do the thing. Prompt the **positive**: state the target behaviour ("write one-line comments") so the banned one is never spoken. A prohibition earns its place only as a hard guardrail you cannot phrase positively; even then, pair it with the positive target so attention lands on what to do.
|
|
75
|
+
|
|
76
|
+
## Pruning
|
|
77
|
+
|
|
78
|
+
- Keep each meaning in a **single source of truth**: one authoritative place, so changing the behaviour is a one-place edit. **Duplication** (the same meaning in more than one place) costs maintenance and tokens, and inflates a meaning's prominence on the ladder past its real rank. (The accidental inverse of a leading word, which repeats a token on purpose, never the meaning.)
|
|
79
|
+
- The **environment** is a source of truth too (`package.json` scripts, config files, the directory layout, `--help` output), and a document that restates it is a **cache**: a copy of a lookup, earning its load only when the lookup is expensive. Cache what the agent cannot find by looking: the unwritten convention, the reason behind a choice, the gotcha no config confesses. Leave the one-file, one-command lookups to the environment, where they cannot go stale.
|
|
80
|
+
- Check every line for **relevance**: does it still bear on what the document does? A line loses relevance by never bearing on the task (mere exposition, or a branch that should be disclosed) or by going stale as the behaviour or world it describes changes. Shorter documents are easier to keep relevant. Without a pruning discipline the default fate is **sediment**: stale layers that settle because adding feels safe and removing feels risky, until you must core down through them to find what is still live.
|
|
81
|
+
- Hunt **no-ops** sentence by sentence: an instruction the model already obeys by default pays load to say nothing. The test (does it change behaviour versus the default?) is model-relative, not reader-relative: two people disagreeing about a no-op disagree about the default, and settle it by running the document, not by debate. When a sentence fails, delete the whole sentence rather than trim words from it. The test also grades leading words: a word too weak to beat the default (_be thorough_ when the agent is already thorough-ish) is a no-op, and the fix is a stronger word (_relentless_), not a different technique.
|
package/dist/subagent.d.mts
CHANGED
|
@@ -1,39 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The one pstack role manifest.
|
|
5
|
-
*
|
|
6
|
-
* Every consumer of the role vocabulary reads this module: `src/roles.ts` for
|
|
7
|
-
* exact lookup and panel classification, `src/models.ts` for value shapes,
|
|
8
|
-
* `scripts/build-assets.ts` for the generated example file, and the
|
|
9
|
-
* `setup-pstack` skill text, which points at that example instead of listing the
|
|
10
|
-
* roles again. A second literal role list anywhere is a bug.
|
|
11
|
-
*
|
|
12
|
-
* Keys are matched exactly after normalization. Commas are part of some keys
|
|
13
|
-
* (`feature, refactoring`), so nothing here may be split on a comma.
|
|
14
|
-
*
|
|
15
|
-
* This module has no Node imports: the Host bundle imports it directly.
|
|
16
|
-
*/
|
|
17
|
-
/** Whether a role holds one route or a comma-separated list of routes. */
|
|
18
|
-
type RoleValueShape = "single" | "list";
|
|
19
|
-
interface RoleSpec {
|
|
20
|
-
/** Exact key as written in the role file. Commas belong to the key. */
|
|
21
|
-
readonly key: string;
|
|
22
|
-
readonly shape: RoleValueShape;
|
|
23
|
-
/**
|
|
24
|
-
* A list role that automatically starts one child per entry. Only the three
|
|
25
|
-
* panel roles set this; every other list role selects one entry.
|
|
26
|
-
*/
|
|
27
|
-
readonly autoPanel: boolean;
|
|
28
|
-
/** Skills and playbooks that read this role. */
|
|
29
|
-
readonly consumers: readonly string[];
|
|
30
|
-
readonly summary: string;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/models.d.ts
|
|
1
|
+
import { _ as ToolsHost, g as ToolDefinition, h as SubagentsHost, m as SubagentCapabilities, n as AgentOptions, r as AgentsHost, s as LlmHost, t as Agent, v as WorkingDirectoryHost } from "./host-contract-CUPSpeNk.mjs";
|
|
2
|
+
import { t as RoleSpec } from "./role-manifest-C3fUzjLI.mjs";
|
|
34
3
|
/** One resolved child route. */
|
|
35
|
-
type
|
|
4
|
+
type Route = {
|
|
36
5
|
readonly kind: "inherit";
|
|
6
|
+
/** The spelling the file used; `undefined` for an implicit fallback. */
|
|
7
|
+
readonly alias?: "inherit-parent" | "auto";
|
|
37
8
|
} | {
|
|
38
9
|
readonly kind: "route";
|
|
39
10
|
readonly provider: string;
|
|
@@ -45,93 +16,43 @@ type RouteSelectionMode = "single" | "panel" | "selected";
|
|
|
45
16
|
interface RouteSelection {
|
|
46
17
|
readonly role: RoleSpec;
|
|
47
18
|
readonly mode: RouteSelectionMode;
|
|
48
|
-
/** Whether the role came from the file or
|
|
19
|
+
/** Whether the role came from the file or the inherit-parent fallback. */
|
|
49
20
|
readonly configured: boolean;
|
|
50
|
-
readonly routes: readonly
|
|
21
|
+
readonly routes: readonly Route[];
|
|
51
22
|
/** How many entries the role holds, before selection. */
|
|
52
23
|
readonly total: number;
|
|
53
24
|
readonly roleIndex?: number;
|
|
54
|
-
readonly issues: readonly string[];
|
|
55
25
|
}
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/effort.d.ts
|
|
58
|
-
/**
|
|
59
|
-
* The `agentOptions` one (route, effort override) pair contributes.
|
|
60
|
-
*
|
|
61
|
-
* The two independent halves are easy to get wrong in opposite directions:
|
|
62
|
-
*
|
|
63
|
-
* - an inherit-parent route with an override must still send `reasoningEffort`,
|
|
64
|
-
* which means `{ reasoningEffort }` on its own is a real `agentOptions` value and
|
|
65
|
-
* the backend still has to support the capability;
|
|
66
|
-
* - an override always wins over the role line, because the caller asked for this
|
|
67
|
-
* delegation specifically.
|
|
68
|
-
*/
|
|
69
|
-
export declare function agentOptionsFor(route: ChildRoute, effortOverride?: string): AgentOptions | undefined;
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/subagent.d.ts
|
|
72
26
|
/** Cordis row name, used by Loader diagnostics. */
|
|
73
27
|
export declare const name = "pstack-subagent";
|
|
74
28
|
/**
|
|
75
|
-
* Delegation needs the tool registry, the subagent registry,
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* has just started, and a composition without it still delegates: the children keep
|
|
79
|
-
* the effort their request carried and cannot change it afterwards. Declaring it as
|
|
80
|
-
* a hard dependency would make the whole row inert in such a profile, so the tool
|
|
81
|
-
* would not exist at all — the failure `pstack-history` already paid for once with
|
|
82
|
-
* `sessionQuery`. It is read per call through `ctx.get("agents")` instead, which is
|
|
83
|
-
* why a controller mounted after this row is still seen.
|
|
29
|
+
* Delegation needs the tool registry, the subagent registry, the LLM adapters, and the
|
|
30
|
+
* session directory. `agents` is not here: it is optional and read per call, so a
|
|
31
|
+
* profile without it still delegates and the child simply keeps its starting effort.
|
|
84
32
|
*/
|
|
85
33
|
export declare const inject: string[];
|
|
86
34
|
/** Model-facing tool name. */
|
|
87
35
|
export declare const TOOL_NAME = "pstack_subagent";
|
|
88
36
|
/** Backend used when the row does not name one. */
|
|
89
37
|
export declare const DEFAULT_SUBAGENT_PROVIDER = "spawn";
|
|
90
|
-
/** Agent type used when the call does not name one. */
|
|
91
|
-
export declare const DEFAULT_AGENT_KIND = "poteto-agent";
|
|
92
38
|
/** The child kinds this tool knows how to brief. */
|
|
93
39
|
export declare const AGENT_KINDS: readonly ["poteto-agent", "comment-sicko", "general"];
|
|
94
40
|
export type AgentKind = (typeof AGENT_KINDS)[number];
|
|
95
|
-
/** One exact route a row may authorize for explicit child selection. */
|
|
96
|
-
export interface AllowedModelRoute {
|
|
97
|
-
readonly provider: string;
|
|
98
|
-
readonly model: string;
|
|
99
|
-
}
|
|
100
41
|
/** Row configuration. */
|
|
101
42
|
export interface PstackSubagentConfig {
|
|
102
|
-
/** `ctx.subagents` provider to start children on. */
|
|
103
43
|
readonly provider: string;
|
|
104
|
-
/**
|
|
105
|
-
* This row's delegation-depth cap. A call may lower it and may never exceed it.
|
|
106
|
-
* Omitted means the Host setting decides.
|
|
107
|
-
*/
|
|
108
44
|
readonly maxDepth?: number;
|
|
109
|
-
/**
|
|
110
|
-
* Exact routes this row authorizes. Empty means no explicit route limit. This is
|
|
111
|
-
* pstack's own check and is unrelated to the native session `allowedModels`
|
|
112
|
-
* policy, which this plugin does not read.
|
|
113
|
-
*/
|
|
114
|
-
readonly allowedModels: readonly AllowedModelRoute[];
|
|
115
|
-
/** Non-empty allowlist; also what makes `agentPreset` appear in the schema. */
|
|
116
|
-
readonly allowedAgentPresets: readonly string[];
|
|
117
45
|
}
|
|
118
|
-
/** What a call asked for, after argument
|
|
46
|
+
/** What a call asked for, after every required argument has been validated. */
|
|
119
47
|
export interface DelegationArgs {
|
|
120
48
|
readonly description: string;
|
|
121
49
|
readonly prompt: string;
|
|
122
50
|
readonly agent: AgentKind;
|
|
123
|
-
readonly role
|
|
124
|
-
readonly cwd
|
|
125
|
-
readonly
|
|
126
|
-
readonly
|
|
127
|
-
readonly
|
|
128
|
-
/**
|
|
129
|
-
* Effort for every child this call starts, overriding each role line's value.
|
|
130
|
-
*
|
|
131
|
-
* Validated per entry against the model that entry will actually request, so a
|
|
132
|
-
* panel with one incompatible entry starts nothing rather than half its children.
|
|
133
|
-
*/
|
|
134
|
-
readonly reasoningEffort?: string;
|
|
51
|
+
readonly role: string | null;
|
|
52
|
+
readonly cwd: string | null;
|
|
53
|
+
readonly maxDepth: number;
|
|
54
|
+
readonly roleIndex: number | null;
|
|
55
|
+
readonly reasoningEffort: string | null;
|
|
135
56
|
}
|
|
136
57
|
/** One child this call started. */
|
|
137
58
|
export interface ChildRecord {
|
|
@@ -140,7 +61,6 @@ export interface ChildRecord {
|
|
|
140
61
|
readonly agent: string;
|
|
141
62
|
readonly role: string;
|
|
142
63
|
readonly route: string;
|
|
143
|
-
/** The effort this child runs at, when any applies. */
|
|
144
64
|
readonly effort?: string;
|
|
145
65
|
readonly maxDepth?: number;
|
|
146
66
|
}
|
|
@@ -158,73 +78,37 @@ export declare class PartialDelegationError extends DelegationError {
|
|
|
158
78
|
readonly startedChildren: readonly ChildRecord[];
|
|
159
79
|
constructor(message: string, startedChildren: readonly ChildRecord[]);
|
|
160
80
|
}
|
|
161
|
-
/** Raised when a required agent preamble is missing or unusable. */
|
|
162
|
-
export declare class PreambleError extends DelegationError {
|
|
163
|
-
constructor(message: string);
|
|
164
|
-
}
|
|
165
81
|
/** The live services and locations one delegation reads. */
|
|
166
82
|
export interface SubagentRuntime {
|
|
167
83
|
readonly subagents: SubagentsHost;
|
|
168
84
|
readonly llm: LlmHost;
|
|
169
|
-
/**
|
|
170
|
-
* The Agent registry, used to reach a child this tool just started.
|
|
171
|
-
*
|
|
172
|
-
* Optional because a row can be composed without the `agents` service and a
|
|
173
|
-
* delegation still works there: the children then keep the effort their request
|
|
174
|
-
* carried and simply cannot change it afterwards. Making it required would turn a
|
|
175
|
-
* missing service into a row that registers no tool at all.
|
|
176
|
-
*/
|
|
85
|
+
/** Optional: absent means the child keeps the effort it was started with. */
|
|
177
86
|
readonly agents?: AgentsHost;
|
|
178
|
-
|
|
87
|
+
readonly workingDirectory: WorkingDirectoryHost;
|
|
179
88
|
readonly dshHome: string;
|
|
180
|
-
/** Absolute package assets root, home of the agent preambles. */
|
|
181
|
-
readonly assetsRoot: string;
|
|
182
|
-
}
|
|
183
|
-
interface StandardSchemaIssue {
|
|
184
|
-
readonly message: string;
|
|
185
|
-
readonly path?: readonly (string | number)[];
|
|
186
|
-
}
|
|
187
|
-
type StandardSchemaResult = {
|
|
188
|
-
readonly value: PstackSubagentConfig;
|
|
189
|
-
readonly issues?: undefined;
|
|
190
|
-
} | {
|
|
191
|
-
readonly issues: readonly StandardSchemaIssue[];
|
|
192
|
-
};
|
|
193
|
-
/**
|
|
194
|
-
* Minimal Standard Schema for this row, so an omitted `config` is valid and a
|
|
195
|
-
* typo fails at load instead of at the first delegation.
|
|
196
|
-
*/
|
|
197
|
-
export declare const Config: {
|
|
198
|
-
"~standard": {
|
|
199
|
-
version: number;
|
|
200
|
-
vendor: string;
|
|
201
|
-
validate(value: unknown): StandardSchemaResult;
|
|
202
|
-
};
|
|
203
|
-
};
|
|
204
|
-
/**
|
|
205
|
-
* Read one agent preamble from the package assets by absolute path.
|
|
206
|
-
*
|
|
207
|
-
* A missing or empty preamble blocks that agent type. It never degrades into a
|
|
208
|
-
* plain child, because a `comment-sicko` or `poteto-agent` child without its
|
|
209
|
-
* instructions is a different agent wearing the name.
|
|
210
|
-
*/
|
|
211
|
-
export declare function loadAgentPreamble(agent: AgentKind, assetsRoot: string): string | undefined;
|
|
212
|
-
/** One absolute path the Host injects into a child brief. */
|
|
213
|
-
export interface InjectedPath {
|
|
214
|
-
readonly label: string;
|
|
215
|
-
readonly path: string;
|
|
216
89
|
}
|
|
217
90
|
/**
|
|
218
|
-
*
|
|
91
|
+
* Validate the row configuration without a Schemastery dependency.
|
|
219
92
|
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
93
|
+
* A typo must fail at activation rather than at the first delegation, and an omitted
|
|
94
|
+
* `config` must be valid. Cordis passes the raw mapping because this row exports no
|
|
95
|
+
* `Config` object; callers that object as `config` are still checked here.
|
|
222
96
|
*/
|
|
97
|
+
export declare function normalizeConfig(value: unknown): PstackSubagentConfig;
|
|
98
|
+
/** The preset id behind each pstack agent kind. `general` joins the parent preset. */
|
|
99
|
+
export declare const AGENT_PRESETS: Readonly<Record<Exclude<AgentKind, "general">, string>>;
|
|
100
|
+
/** The preset a child of this kind must mount, or undefined to join the parent preset. */
|
|
101
|
+
export declare function agentPresetFor(agent: AgentKind): string | undefined;
|
|
102
|
+
/** Compose the self-contained prompt one child receives. */
|
|
223
103
|
export declare function composeChildPrompt(input: {
|
|
224
|
-
readonly
|
|
225
|
-
|
|
104
|
+
readonly injectedPaths?: readonly {
|
|
105
|
+
readonly label: string;
|
|
106
|
+
readonly path: string;
|
|
107
|
+
}[];
|
|
226
108
|
readonly task: string;
|
|
227
109
|
}): string;
|
|
110
|
+
/** Validate every required model-facing argument. Null declines an optional setting. */
|
|
111
|
+
export declare function parseDelegationArgs(raw: unknown): DelegationArgs;
|
|
228
112
|
/** One planned child, before any Host call. */
|
|
229
113
|
export interface ChildPlan {
|
|
230
114
|
readonly index: number;
|
|
@@ -232,16 +116,15 @@ export interface ChildPlan {
|
|
|
232
116
|
readonly label: string;
|
|
233
117
|
readonly agent: AgentKind;
|
|
234
118
|
readonly role: string;
|
|
235
|
-
readonly route:
|
|
119
|
+
readonly route: Route;
|
|
236
120
|
readonly routeLabel: string;
|
|
237
|
-
/** The effort this child will actually run at: the override when present, else the role line's. */
|
|
238
121
|
readonly effort?: string;
|
|
239
122
|
readonly agentOptions?: AgentOptions;
|
|
123
|
+
/** Preset id that supplies this child's persona and tool composition. */
|
|
240
124
|
readonly agentPreset?: string;
|
|
241
125
|
readonly cwd?: string;
|
|
242
126
|
readonly maxDepth?: number;
|
|
243
127
|
}
|
|
244
|
-
/** The decided plan for one call. */
|
|
245
128
|
export interface DelegationPlan {
|
|
246
129
|
readonly agent: AgentKind;
|
|
247
130
|
readonly prompt: string;
|
|
@@ -250,41 +133,15 @@ export interface DelegationPlan {
|
|
|
250
133
|
readonly mode: RouteSelection["mode"];
|
|
251
134
|
readonly roleIndex?: number;
|
|
252
135
|
readonly roleTotal: number;
|
|
253
|
-
/** The call-wide effort override, when it supplied one. */
|
|
254
136
|
readonly reasoningEffort?: string;
|
|
255
137
|
readonly children: readonly ChildPlan[];
|
|
256
138
|
readonly diagnostics: readonly string[];
|
|
257
139
|
}
|
|
258
|
-
/**
|
|
259
|
-
export declare function routeLabel(route:
|
|
260
|
-
/**
|
|
261
|
-
* The route text a caller sees when an effort override wins.
|
|
262
|
-
*
|
|
263
|
-
* `routeLabel` describes the role file, which stops being the whole truth once the
|
|
264
|
-
* caller overrode the effort. Reporting the file's value there would tell the model
|
|
265
|
-
* its override had been ignored.
|
|
266
|
-
*/
|
|
267
|
-
export declare function plannedRouteLabel(route: ChildRoute, effortOverride?: string): string;
|
|
268
|
-
/**
|
|
269
|
-
* Take the smallest of the requested depth, this row's cap, and the Host setting.
|
|
270
|
-
*
|
|
271
|
-
* A request above the row cap is an error rather than a silent clamp, so a caller
|
|
272
|
-
* cannot believe it asked for two levels when the row allows one.
|
|
273
|
-
*/
|
|
140
|
+
/** Route text as reported to the model. */
|
|
141
|
+
export declare function routeLabel(route: Route, effortOverride?: string): string;
|
|
142
|
+
/** Take the smallest of the requested depth, this row's cap, and the Host setting. */
|
|
274
143
|
export declare function resolveDelegationDepth(configured: number | undefined, requested: number | undefined, hostLimit: number | undefined): number | undefined;
|
|
275
|
-
/**
|
|
276
|
-
* Validate the model-facing arguments.
|
|
277
|
-
*
|
|
278
|
-
* The tool schema is advisory at the model boundary, so every constraint is
|
|
279
|
-
* re-checked here and reported with the reason.
|
|
280
|
-
*/
|
|
281
|
-
export declare function parseDelegationArgs(raw: unknown, config?: PstackSubagentConfig): DelegationArgs;
|
|
282
|
-
/**
|
|
283
|
-
* Resolve the role file, the routes, the prompt, and the depth into one plan.
|
|
284
|
-
*
|
|
285
|
-
* Pure with respect to the Host: it reads the role file and the packaged preamble,
|
|
286
|
-
* and it makes no service call.
|
|
287
|
-
*/
|
|
144
|
+
/** Resolve the role file, routes, prompt, and depth into one plan. Pure of service calls. */
|
|
288
145
|
export declare function planDelegation(args: DelegationArgs, runtime: SubagentRuntime, config?: PstackSubagentConfig): DelegationPlan;
|
|
289
146
|
/** Check the backend can enforce what this call asks for. */
|
|
290
147
|
export declare function assertProviderCapabilities(capabilities: SubagentCapabilities, providerName: string, asks: {
|
|
@@ -293,44 +150,35 @@ export declare function assertProviderCapabilities(capabilities: SubagentCapabil
|
|
|
293
150
|
readonly maxDepth: boolean;
|
|
294
151
|
}): void;
|
|
295
152
|
/**
|
|
296
|
-
*
|
|
153
|
+
* Resolve and validate one child's `cwd`.
|
|
297
154
|
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
155
|
+
* A child may run inside the session directory or inside an explicitly separate Git
|
|
156
|
+
* worktree. Anything else is refused: this tool does not create isolation, so it will
|
|
157
|
+
* not promise one.
|
|
158
|
+
*/
|
|
159
|
+
export declare function resolveChildCwd(requested: string | undefined, sessionRoot: string): string | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* Start the planned children. Everything rejectable has already been rejected; a
|
|
162
|
+
* failure at entry N keeps children 1..N-1 running and reports their ids.
|
|
301
163
|
*/
|
|
302
164
|
export declare function startPlannedChildren(parent: Agent, plan: DelegationPlan, runtime: SubagentRuntime, config: PstackSubagentConfig, signal: AbortSignal): Promise<DelegationResult>;
|
|
303
165
|
/** Full delegation: plan, validate, start. */
|
|
304
166
|
export declare function delegate(parent: Agent, args: DelegationArgs, runtime: SubagentRuntime, config?: PstackSubagentConfig, signal?: AbortSignal): Promise<DelegationResult>;
|
|
305
|
-
export declare const OUTPUT_SCHEMA: JsonSchemaNode;
|
|
306
167
|
/** Render one delegation result for the model. */
|
|
307
168
|
export declare function renderDelegationResult(result: DelegationResult): string;
|
|
308
169
|
/** Build the model-facing tool for one row. */
|
|
309
170
|
export declare function createPstackSubagentTool(runtime: SubagentRuntime, config?: PstackSubagentConfig): ToolDefinition;
|
|
310
|
-
/**
|
|
311
|
-
* The slices of the Cordis context this row uses.
|
|
312
|
-
*
|
|
313
|
-
* `agents` is optional in both directions: it is absent from `inject` and read per
|
|
314
|
-
* call below, so a profile that mounts no agent registry still registers this tool.
|
|
315
|
-
* See the `inject` comment for why a hard dependency is the wrong shape here.
|
|
316
|
-
*/
|
|
171
|
+
/** The slices of the Cordis context this row uses. */
|
|
317
172
|
export interface PstackSubagentHost {
|
|
318
173
|
readonly tools: ToolsHost;
|
|
319
174
|
readonly subagents: SubagentsHost;
|
|
320
175
|
readonly llm: LlmHost;
|
|
176
|
+
readonly workingDirectory: WorkingDirectoryHost;
|
|
321
177
|
}
|
|
322
178
|
/** Build the runtime a real Host call reads. */
|
|
323
179
|
export declare function hostRuntime(ctx: PstackSubagentHost, getAgentRegistry?: () => AgentsHost | undefined): SubagentRuntime;
|
|
324
|
-
/**
|
|
325
|
-
* Register `pstack_subagent` for this row.
|
|
326
|
-
*
|
|
327
|
-
* @param ctx - context providing the tool registry, the subagent registry, the LLM
|
|
328
|
-
* adapters, and optionally `ctx.get` for the agent registry.
|
|
329
|
-
* @param config - validated row config.
|
|
330
|
-
*/
|
|
180
|
+
/** Register `pstack_subagent` for this row. */
|
|
331
181
|
export declare function apply(ctx: PstackSubagentHost & {
|
|
332
182
|
get?: (name: string) => AgentsHost | undefined;
|
|
333
|
-
}, config?:
|
|
334
|
-
|
|
335
|
-
export {};
|
|
336
|
-
//# sourceMappingURL=subagent.d.mts.map
|
|
183
|
+
}, config?: unknown): void;
|
|
184
|
+
export {};
|