pi-aia-asf 0.3.0 → 0.4.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/CHANGELOG.md +68 -1
- package/README.md +3 -0
- package/index.ts +7 -1
- package/package.json +5 -2
- package/skills/aia-asf/SKILL.md +13 -0
- package/skills/aia-asf/references/06d-delegation.md +130 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,11 +7,78 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.0] - 2026-08-28
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Delegation reference `references/06d-delegation.md`** — codifies the two
|
|
15
|
+
delegation mechanisms available to ASF work: **intercom** (message another
|
|
16
|
+
live pi session that owns relevant context — `list` first, say what you want
|
|
17
|
+
back, treat peer findings as evidence, not proof) and **subagents** (spawn an
|
|
18
|
+
isolated `pi -p` process when the OUTCOME matters more than the trace — scoped
|
|
19
|
+
codebase research, independent parallel fixes, fresh-perspective review).
|
|
20
|
+
- **Two verified hard limits, backed by experiment** (both documented as
|
|
21
|
+
anti-patterns in SKILL.md):
|
|
22
|
+
- **Never run parallel subagents against the same file.** Tested: 4 concurrent
|
|
23
|
+
whole-file writers left only 1 of 4 edits, silently, all exiting 0 — the
|
|
24
|
+
no-mutual-dependencies rule is enforced by physics, not preference.
|
|
25
|
+
- **Exit code 0 does not mean success.** Tested: a subagent asked to read a
|
|
26
|
+
non-existent file exited 0. Always validate the returned output.
|
|
27
|
+
- **`pi-intercom` as a declared dependency** (`dependencies` in package.json,
|
|
28
|
+
`^0.10.1`) — `npm install` pulls it in. Intentionally **not bundled**: a
|
|
29
|
+
bundled copy conflicts with a top-level `pi install npm:pi-intercom`
|
|
30
|
+
(tool-name collision, verified), so the tool must be installed top-level to
|
|
31
|
+
register. Added to the ASF runtime dependency check (`/asf` summary now lists
|
|
32
|
+
all five: pi-vigilant, pi-smart-web-search, pi-smart-fetch, pi-aia-browser,
|
|
33
|
+
pi-intercom).
|
|
34
|
+
- **SKILL.md wiring** — Phase 6 delegation note, reference index entry, and
|
|
35
|
+
three new anti-patterns (same-file parallel subagents, trusting subagent exit
|
|
36
|
+
codes/self-reports, re-deriving context another live session already has).
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- README dependencies table now lists pi-intercom with the not-bundled rationale.
|
|
41
|
+
|
|
10
42
|
## [0.3.0] - 2026-08-25
|
|
11
43
|
|
|
12
44
|
### Added
|
|
13
45
|
|
|
14
|
-
-
|
|
46
|
+
- **Mechanical spec-to-code traceability gate in `/asf verify`** (large work
|
|
47
|
+
only) — reads the shared spec-memory task and validates every `met` spec's
|
|
48
|
+
trace (`outcome → codePath → testFile + assertion`); `testFile` must exist
|
|
49
|
+
and `assertion` must appear in it. Outputs a traceability matrix with
|
|
50
|
+
PASS/FAIL rows and refuses delivery on FAIL (`GATE NOT PASSED`). Small work
|
|
51
|
+
keeps the checklist only — no mechanical gate (scale proportionality).
|
|
52
|
+
- **New QA rules (06b-testing-qa.md)**: Rule 12 — test the operator-facing
|
|
53
|
+
outcome, not the machinery (Betamaxx dead-code failure); Rule 13 — nothing
|
|
54
|
+
is delivered until consumed by a surface (UI or API); Rule 14 — every
|
|
55
|
+
feature spec ships an E2E behavioral test through the real entry point.
|
|
56
|
+
Rule 9 extended for silent async paths; Rule 10 DoD extended (traceability,
|
|
57
|
+
consumed-by-surface, E2E).
|
|
58
|
+
- **M4 — challenge approved designs during implementation** (06-implementation.md):
|
|
59
|
+
product tension → resolve with the user before implementing.
|
|
60
|
+
- **M5 — the delivery log is a claim; the code is the evidence**: trace the
|
|
61
|
+
actual code path before marking anything delivered.
|
|
62
|
+
- **M6 — external planning docs are specs, not ground truth** (01-intake.md +
|
|
63
|
+
SKILL.md Phase 1/3): locate IMPROVEMENT-PLAN.md / PLAN.md / requirements
|
|
64
|
+
docs / delivery logs / tickets, ingest every actionable item as a captured
|
|
65
|
+
spec; their ✅ markers are claims, not evidence.
|
|
66
|
+
- **Adversarial traceability lens** (04-adversarial.md): operator-facing
|
|
67
|
+
outcome + code path + where dead wiring hides.
|
|
68
|
+
- **PLAN.md traceability matrix** (05-plan.md): spec → outcome → code path →
|
|
69
|
+
test.
|
|
70
|
+
- DoD checklist extended; anti-patterns added (delivery-log trust, machinery
|
|
71
|
+
without a surface, unit tests as wiring proof, external plan checkmarks,
|
|
72
|
+
literal implementation of tension-creating specs).
|
|
73
|
+
|
|
74
|
+
### Changed
|
|
75
|
+
|
|
76
|
+
- `/asf verify` output now shows scale and, for large work, the mechanical
|
|
77
|
+
traceability matrix before the DoD checklist.
|
|
78
|
+
|
|
79
|
+
### Requires
|
|
80
|
+
|
|
81
|
+
- pi-vigilant 0.1.3+ (provides the `trace` field on specs).
|
|
15
82
|
|
|
16
83
|
|
|
17
84
|
## [0.2.2] - 2026-08-14
|
package/README.md
CHANGED
|
@@ -41,6 +41,9 @@ You can also force/start a session explicitly:
|
|
|
41
41
|
| **pi-smart-web-search** | `web_search` | `pi install npm:pi-smart-web-search` |
|
|
42
42
|
| **pi-smart-fetch** | `web_fetch`, `batch_web_fetch` | `pi install npm:pi-smart-fetch` |
|
|
43
43
|
| **pi-aia-browser** | `browser_init`, `browser_navigate`, … (Playwright + Chromium, auto-installed) | `pi install npm:pi-aia-browser` |
|
|
44
|
+
| **pi-intercom** | `intercom` — message other live pi sessions directly (delegation, cross-session verification) | `pi install npm:pi-intercom` |
|
|
45
|
+
|
|
46
|
+
`pi-intercom` is also declared in `dependencies` in `package.json`, so `npm install` of this package pulls it in. It is intentionally **not bundled** into the tarball: bundling it would conflict with a top-level `pi install npm:pi-intercom` (tool name collision), so the tool must be installed at top level to register.
|
|
44
47
|
|
|
45
48
|
The extension warns at startup (and on `/asf` with no args) when any dependency is missing.
|
|
46
49
|
|
package/index.ts
CHANGED
|
@@ -215,6 +215,12 @@ function checkDependencies(): DependencyCheck[] {
|
|
|
215
215
|
existsSync(join(gitDir, "github.com", "brunoj", "pi-aia-browser")),
|
|
216
216
|
hint: "pi install npm:pi-aia-browser (installs Playwright + Chromium)",
|
|
217
217
|
},
|
|
218
|
+
{
|
|
219
|
+
name: "pi-intercom (intercom: message other pi sessions)",
|
|
220
|
+
package: "pi-intercom",
|
|
221
|
+
present: existsSync(join(npmDir, "pi-intercom")),
|
|
222
|
+
hint: "pi install npm:pi-intercom",
|
|
223
|
+
},
|
|
218
224
|
];
|
|
219
225
|
|
|
220
226
|
return checks;
|
|
@@ -224,7 +230,7 @@ function dependencySummary(): string {
|
|
|
224
230
|
const checks = checkDependencies();
|
|
225
231
|
const missing = checks.filter((c) => !c.present);
|
|
226
232
|
if (missing.length === 0) {
|
|
227
|
-
return "All ASF dependencies present: pi-vigilant, pi-smart-web-search, pi-smart-fetch, pi-aia-browser ✓";
|
|
233
|
+
return "All ASF dependencies present: pi-vigilant, pi-smart-web-search, pi-smart-fetch, pi-aia-browser, pi-intercom ✓";
|
|
228
234
|
}
|
|
229
235
|
return (
|
|
230
236
|
"⚠️ ASF dependencies missing — install before starting a project:\n" +
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-aia-asf",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Ai Applied Agentic Software Factory — codifies the full software development flow: intake, research, spec capture, adversarial analysis, planning with approval gates, test-first implementation, and release. Requires pi-vigilant, pi-smart-web-search, pi-smart-fetch,
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Ai Applied Agentic Software Factory — codifies the full software development flow: intake, research, spec capture, adversarial analysis, planning with approval gates, test-first implementation, and release. Requires pi-vigilant, pi-smart-web-search, pi-smart-fetch, pi-aia-browser, and pi-intercom.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
7
7
|
"software-factory",
|
|
@@ -48,6 +48,9 @@
|
|
|
48
48
|
"@earendil-works/pi-coding-agent": "*",
|
|
49
49
|
"typebox": "*"
|
|
50
50
|
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"pi-intercom": "^0.10.1"
|
|
53
|
+
},
|
|
51
54
|
"peerDependenciesMeta": {
|
|
52
55
|
"@earendil-works/pi-ai": {
|
|
53
56
|
"optional": false
|
package/skills/aia-asf/SKILL.md
CHANGED
|
@@ -182,6 +182,15 @@ Keep the plan **implementation-ready**: any competent engineer (or agent) can ex
|
|
|
182
182
|
> understand; layered with clear boundaries and an architecture writeup; full I/O debug
|
|
183
183
|
> logging with replay; nothing breaks existing functionality.
|
|
184
184
|
|
|
185
|
+
> **Read `references/06d-delegation.md` before delegating.** Work may be delegated two ways:
|
|
186
|
+
> **intercom** (message another live pi session that owns relevant context — always `list`
|
|
187
|
+
> first, say what you want back, and treat their findings as evidence, not proof), and
|
|
188
|
+
> **subagents** (spawn an isolated `pi -p` process when the OUTCOME matters more than the
|
|
189
|
+
> trace — scoped codebase research, independent parallel fixes, fresh-perspective review).
|
|
190
|
+
> Two verified hard limits: **never run parallel subagents against the same file** — tested,
|
|
191
|
+
> 4 concurrent writers left only 1 of 4 edits, silently, all exiting 0 — and **exit code 0
|
|
192
|
+
> does not mean success**, so always validate the returned output against what you asked for.
|
|
193
|
+
|
|
185
194
|
Execute the task list milestone by milestone. Discipline rules:
|
|
186
195
|
|
|
187
196
|
1. **Test-first**: write/update tests before or with implementation; run them; only commit green.
|
|
@@ -246,6 +255,9 @@ Also check the **modularity DoD** from `references/06c-code-quality.md` (Phase 7
|
|
|
246
255
|
- ❌ Escalation/fallback logic re-implemented per caller instead of one shared escalation path
|
|
247
256
|
- ❌ Shipping a module that cannot run/test standalone outside the host
|
|
248
257
|
- ❌ Refactoring without the architecture writeup (see `references/06c-code-quality.md`)
|
|
258
|
+
- ❌ Running parallel subagents that touch the same file — edits are silently lost (see `references/06d-delegation.md`)
|
|
259
|
+
- ❌ Trusting a subagent's exit code or self-report instead of verifying the actual code/test result
|
|
260
|
+
- ❌ Re-deriving context another live session already has instead of asking it over intercom
|
|
249
261
|
- ❌ Breaking existing functionality during a refactor — refactoring preserves behavior
|
|
250
262
|
- ❌ Marking a spec delivered from the delivery log instead of tracing the code — the log is a claim
|
|
251
263
|
- ❌ Shipping machinery no surface consumes — delivered = visible in the product (UI or API)
|
|
@@ -262,4 +274,5 @@ Also check the **modularity DoD** from `references/06c-code-quality.md` (Phase 7
|
|
|
262
274
|
- `references/06-implementation.md` — coding discipline details (incl. M4 challenge designs, M5 trace before claiming)
|
|
263
275
|
- `references/06b-testing-qa.md` — **mandatory testing & QA standard** (14 rules + definition of done)
|
|
264
276
|
- `references/06c-code-quality.md` — **mandatory modularity & maintainability standard** (8 rules, SSOT, testable-standalone, single escalation path)
|
|
277
|
+
- `references/06d-delegation.md` — **intercom & subagents**: when to message another session, when to spawn isolated workers, the no-mutual-dependencies rule, and why exit codes lie
|
|
265
278
|
- `references/07-release.md` — release workflow (versioning, CHANGELOG, tags, npm, CI/CD)
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Delegation: Intercom & Subagents
|
|
2
|
+
|
|
3
|
+
ASF work does not have to happen in one session, in one context window, or one task at a time. Two delegation mechanisms are available. They solve different problems and must not be confused.
|
|
4
|
+
|
|
5
|
+
| | **Intercom** | **Subagents** |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| What it is | Messaging between *live pi sessions* | Spawning a *fresh, isolated pi process* |
|
|
8
|
+
| Peer | A human-driven or long-running session with its own context and history | A stateless worker that exits when done |
|
|
9
|
+
| You get back | A conversation (peer can push back, ask, disagree) | One result |
|
|
10
|
+
| Use when | Another session owns the context/decision | You want the OUTCOME, not the trace |
|
|
11
|
+
| Cost | Cheap (a message) | A whole context window + model spend |
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Part 1 — Intercom: passing messages to other sessions
|
|
16
|
+
|
|
17
|
+
Other pi sessions on this machine are often working on directly relevant things: the same monorepo, an adjacent service, the package you depend on. **Use intercom to talk to them directly instead of guessing, duplicating their work, or routing everything through the user.**
|
|
18
|
+
|
|
19
|
+
### When to use intercom
|
|
20
|
+
|
|
21
|
+
- **Another session owns the context.** They have the repo loaded, the failure reproduced, the domain knowledge. Ask them rather than re-deriving it.
|
|
22
|
+
- **Your change affects their work.** You changed a shared interface, published a version, moved a file they depend on. Tell them.
|
|
23
|
+
- **You need independent verification.** A second session reproducing your result is stronger evidence than your own re-run (see 06b Rule 11).
|
|
24
|
+
- **Cross-project coordination.** Your package is their dependency; sequencing matters.
|
|
25
|
+
- **You found something they need to know.** A bug in shared code, a broken assumption, a security issue.
|
|
26
|
+
|
|
27
|
+
### How
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
intercom({ action: "list" }) // who is live
|
|
31
|
+
intercom({ action: "send", to: "<name-or-id>", message: "…" }) // fire-and-forget
|
|
32
|
+
intercom({ action: "ask", to: "<name-or-id>", message: "…" }) // wait for a reply
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Target by session name, full ID, or the short id in parentheses from `list`. Use `cwd` to scope to a directory when two sessions share a name.
|
|
36
|
+
|
|
37
|
+
### Rules
|
|
38
|
+
|
|
39
|
+
1. **`list` before you send.** Don't message a session that isn't live.
|
|
40
|
+
2. **Say what you want back.** "Please verify X and reply with the result" beats "FYI X."
|
|
41
|
+
3. **Give them what they need to act** — file paths, repro commands, exact error text. Assume zero shared context.
|
|
42
|
+
4. **`ask` blocks; `send` doesn't.** Use `ask` only when you genuinely need the answer before continuing.
|
|
43
|
+
5. **Hand over your weak points, not just your conclusions.** If you want a peer to verify, tell them what you did *not* test and what you'd most like broken. A peer who only receives conclusions will rubber-stamp them.
|
|
44
|
+
6. **Their findings are evidence, not proof.** An independent reproduction is strong; an unverified claim from a peer is still a claim (06b Rule 12, and M5: the log is a claim, the code is the evidence).
|
|
45
|
+
7. **Don't leak the user's private context** across projects without reason.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Part 2 — Subagents: delegating for the outcome
|
|
50
|
+
|
|
51
|
+
A subagent is a **fresh `pi` process with its own context window**. It takes a task, works independently, returns a result, and exits. The parent context never sees its intermediate tool calls — only the answer.
|
|
52
|
+
|
|
53
|
+
> **Core principle: subagents are context isolation, not role-play.** The point is to keep 5,000 lines of grep/read output out of the parent context, not to create "personas."
|
|
54
|
+
|
|
55
|
+
### When to spawn a subagent
|
|
56
|
+
|
|
57
|
+
Spawn when **the outcome matters more than the trace**:
|
|
58
|
+
|
|
59
|
+
- **Scoped codebase research.** "Which module owns retry logic, and what's its interface?" The search noise is worthless once the answer exists. *Signal: gathering the answer means reading many files.*
|
|
60
|
+
- **Independent small changes with NO MUTUAL DEPENDENCIES.** Three unrelated files each needing the same mechanical fix — run them in parallel.
|
|
61
|
+
- **Fresh-perspective review.** A reviewer that never saw your reasoning catches what familiarity hides. Especially valuable for challenging an approved design (06-implementation M4).
|
|
62
|
+
- **Bounded, noisy verification.** Running a long test matrix and reporting just the failures.
|
|
63
|
+
|
|
64
|
+
**Rule of thumb:** if the task needs exploring many files, or there are 3+ genuinely independent pieces of work, delegate.
|
|
65
|
+
|
|
66
|
+
### When NOT to spawn a subagent
|
|
67
|
+
|
|
68
|
+
- **Sequential/dependent work.** If step 2 needs step 1's full output, one context is cleaner than a relay.
|
|
69
|
+
- **Anything touching the same file.** See the hard evidence below.
|
|
70
|
+
- **Small tasks.** Delegation overhead exceeds the benefit. Just do it.
|
|
71
|
+
- **Work needing judgment you'd have to fully specify anyway.** If writing the task description costs more than doing the work, do the work.
|
|
72
|
+
- **The core implementation of a gated (LARGE) change.** You own the specs and the traceability. Delegate research and isolated fixes around it, not the spec-carrying work itself.
|
|
73
|
+
- **Nested delegation.** A subagent must not spawn subagents. Keep the tree one level deep.
|
|
74
|
+
|
|
75
|
+
### ⚠️ The no-mutual-dependencies rule is not advisory — it is enforced by physics
|
|
76
|
+
|
|
77
|
+
**Verified experimentally.** Four subagents were told to each change a different key in the *same* file, reading it and writing the complete file back:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
before: { a: 1, b: 2, c: 3, d: 4 } → 4 agents, one key each
|
|
81
|
+
after: { a: 1, b: 2, c: 3, d: 99 } → 1 of 4 edits survived
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Three edits were silently lost.** Every agent reported success. Every process exited 0. There was no error, no conflict marker, no warning — just a file that quietly lost 75% of the intended work.
|
|
85
|
+
|
|
86
|
+
Concurrent agents each read a snapshot and write back a whole file; last writer wins. Therefore:
|
|
87
|
+
|
|
88
|
+
- **Never run parallel subagents against the same file.** Partition by file, and state the partition in each task.
|
|
89
|
+
- If two tasks *might* touch the same file, they are dependent — **run them sequentially or do them yourself**.
|
|
90
|
+
- Independence must be verified before spawning, not assumed. If you cannot name the disjoint file set, you do not have independence.
|
|
91
|
+
|
|
92
|
+
### ⚠️ Exit code 0 does NOT mean the task succeeded
|
|
93
|
+
|
|
94
|
+
**Verified:** a subagent asked to read a non-existent file explained the problem conversationally and **exited 0**.
|
|
95
|
+
|
|
96
|
+
Never treat process exit status as the success signal. **Validate the returned output against what you asked for.** If a subagent was supposed to change code, verify the code changed — read the file, run the test. This is the delegation-shaped instance of M5: *the report is a claim; the code is the evidence.*
|
|
97
|
+
|
|
98
|
+
### How to spawn
|
|
99
|
+
|
|
100
|
+
There is **no built-in subagent tool in pi** — this is deliberate ("no sub-agents" is a stated design choice; you compose it yourself). Two supported routes:
|
|
101
|
+
|
|
102
|
+
**1. Direct subprocess (always available, zero install):**
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pi -p "<task>" --no-extensions --no-skills -t read,grep,find,ls
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Run several in the background and `wait` for them to parallelize.
|
|
109
|
+
|
|
110
|
+
**2. A subagent extension** (e.g. the `subagent/` example shipped with pi, or a package providing agent orchestration) — gives streaming output, parallel/chain modes, and usage tracking. Prefer this when available; fall back to `pi -p`.
|
|
111
|
+
|
|
112
|
+
### Rules for spawning
|
|
113
|
+
|
|
114
|
+
1. **Restrict tools to the job.** Research agents get read-only (`-t read,grep,find,ls`). Never hand write access to a task that only needs to look.
|
|
115
|
+
2. **Use `--no-extensions --no-skills` for research.** Faster, cheaper, and it prevents a subagent from writing to shared state (specs, feedback) that belongs to the parent task.
|
|
116
|
+
3. **Specify the output format.** "Return: file path, function name, and the 3-line interface — nothing else." Unspecified output returns an essay.
|
|
117
|
+
4. **Bounded, stateless, single-responsibility.** A subagent that needs prior conversation is the wrong tool.
|
|
118
|
+
5. **Partition writes by file** and say so explicitly in every parallel task.
|
|
119
|
+
6. **Verify the result yourself** (see exit-code warning). For code changes: read the file or run the test.
|
|
120
|
+
7. **Cap the fan-out.** A handful of parallel agents, not dozens; each costs a full context window.
|
|
121
|
+
8. **One level deep.** No nesting.
|
|
122
|
+
|
|
123
|
+
### Interaction with ASF gates
|
|
124
|
+
|
|
125
|
+
Delegation changes **who does the work**, never **what must be proven**:
|
|
126
|
+
|
|
127
|
+
- Specs, traceability, and the `/asf verify` gate remain the **parent's** responsibility. A subagent cannot discharge a spec.
|
|
128
|
+
- The QA standard (06b) applies to delegated work identically. "A subagent did it" is not evidence.
|
|
129
|
+
- Subagent findings enter the record as **claims** until verified against code or tests.
|
|
130
|
+
- For LARGE work, the approval gate is unaffected: no subagent may start implementation before plan approval.
|