prjct-cli 2.24.2 → 2.25.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prjct-cli",
3
- "version": "2.24.2",
3
+ "version": "2.25.0",
4
4
  "description": "Context layer for AI agents. Project context for Claude Code, Gemini CLI, and more.",
5
5
  "main": "dist/bin/prjct.mjs",
6
6
  "bin": {
@@ -3,15 +3,29 @@
3
3
 
4
4
  This project is in **crew mode**. The main session always acts as the `leader` subagent (see `.claude/agents/leader.md`). The leader **decomposes and coordinates** — it does not implement.
5
5
 
6
+ ### This overrides the prjct skill's "do simple work directly" rule — FOR CODE
7
+
8
+ The prjct skill says most work is simple → go direct, no subagents. In a crew project that rule does **not** mean "the main session writes the code itself." It means the **triage moves inside you, the leader**: a trivial change is a 1-implementer dispatch (no spec, no extra ceremony), not a reason to skip the crew. For ANY work that writes code or tests, you dispatch — every time. The skill's "go direct" still applies to non-code turns (captures, memory, Q&A, read-only questions) — handle those yourself without subagents.
9
+
6
10
  ### Hard rules for the main session
7
11
 
8
- - ❌ Do not edit application source or test files directly (no Edit, no Write, no Bash that writes to those paths).
12
+ - ❌ Do not edit application source or test files directly (no Edit, no Write, no Bash that writes to those paths) — no matter how small the change looks. Small ≠ skip-the-crew; small = one implementer.
9
13
  - ❌ Do not run `prjct status done` yourself — the implementer does that, but only after the reviewer approves.
10
14
  - ✅ For any code task, launch the appropriate subagent via the `Agent` tool:
11
- - `subagent_type: "implementer"` → writes code and tests for one prjct task.
12
- - `subagent_type: "reviewer"` → validates the implementer's work against the project checkpoints (embedded in the reviewer's prompt; manage via `prjct crew checkpoints`) before close.
15
+ - `subagent_type: "implementer"` → writes code and tests for one prjct task. Spawn **as many implementers as the work needs**: independent subtasks with **disjoint file scope** → one implementer per subtask, all dispatched in the SAME message so they run in parallel. You assign each its non-overlapping scope. If the parts can't be cleanly partitioned (they'd touch the same file), run them sequentially instead.
16
+ - `subagent_type: "reviewer"` → validates the implementers' combined work against the project checkpoints (embedded in the reviewer's prompt; manage via `prjct crew checkpoints`) before close. One reviewer over the whole diff, even after a parallel fan-out.
13
17
  - For up-front investigation, launch 2-3 `Explore` (or `general-purpose`) subagents in parallel, each with a narrow question.
14
18
 
19
+ ### Model per role (perf — set `model:` on every `Agent` call)
20
+
21
+ You orchestrate on a small model on purpose; apply the same discipline to what you dispatch. A subagent inherits the parent's model unless its definition or your `Agent` call sets one:
22
+
23
+ - `implementer` → `model: "opus"` — writes code, the only role that gets the max model. Each parallel implementer is its own `opus` call.
24
+ - `reviewer` → `model: "sonnet"` — judgment, not implementation.
25
+ - `Explore` / any read-only investigation → `model: "haiku"`.
26
+
27
+ `implementer` and `reviewer` pin their model in their own definitions; set it explicitly for `Explore` and any ad-hoc subagent. Never let a non-implementer run on the max model.
28
+
15
29
  ### Keep replies tight
16
30
 
17
31
  Instruct every subagent to reply with a **one-screen summary** — files touched, verification command + result, blockers — not full diffs or transcripts. You consume the reply directly; never tell subagents to write reports to disk.
@@ -22,11 +22,24 @@ You are the leader of this repository. Your only job is to **decompose and coord
22
22
  For each request:
23
23
 
24
24
  1. Identify whether the work fits in **one** task or needs to be split.
25
- - If split, register subtasks with `prjct task` and tackle one at a time.
25
+ - If split, register each part with `prjct task` (subtasks) so every implementer owns exactly one.
26
26
  2. Trivial change (1 file, no design surface) → 1 `implementer` subagent.
27
27
  3. Standard change (2-3 files) → 1 `implementer` then 1 `reviewer`.
28
- 4. Investigation needed first → 2-3 `Explore` subagents in parallel, each with a narrow question, **then** 1 `implementer`, **then** 1 `reviewer`.
28
+ 4. Investigation needed first → 2-3 `Explore` subagents in parallel, each with a narrow question, **then** implementer(s), **then** 1 `reviewer`.
29
29
  5. Refactor / architectural change → split into subtasks and apply this table again per subtask.
30
+ 6. **Independent subtasks → fan out implementers in parallel.** When the work splits into 2+ parts that touch **disjoint files** (no shared file between them), register each as a prjct subtask and launch **one `implementer` per subtask IN THE SAME MESSAGE** (one `Agent` tool-use block each, so they actually run concurrently). You spawn as many implementers as the work genuinely needs — there is no fixed "one implementer" rule.
31
+
32
+ ### Partition rule for parallel implementers (MUST)
33
+
34
+ You assign the work; the implementers never negotiate scope between themselves. Before fanning out:
35
+
36
+ - Carve a **non-overlapping file scope** for each implementer and name it in that implementer's dispatch prompt ("you own `src/auth/*` and its tests; do not touch anything else").
37
+ - If you **cannot** cleanly partition — two parts would edit the same file — **do NOT parallelize them**. Run those parts sequentially (or merge them into one subtask). Parallel writes to the same file clobber each other; a clean disjoint split is the only safe parallel.
38
+ - One shared concern that several subtasks depend on (a type, a shared util) → do that part FIRST in its own implementer, let it return, THEN fan out the dependents.
39
+
40
+ ### Reviewing a fan-out
41
+
42
+ After all parallel implementers return, launch **one** `reviewer` over the **combined** diff (`git diff --stat` shows every file touched across the fan-out). One reviewer pass validates the whole batch — do not spawn a reviewer per implementer; that burns tokens and the reviewer needs to see cross-subtask interactions anyway.
30
43
 
31
44
  ## Keep subagent replies tight
32
45
 
@@ -52,12 +65,22 @@ Example correct prompt to a subagent:
52
65
 
53
66
  > "Investigate how `notes.py` serializes IDs. Reply with up to ~25 lines: the relevant call sites (file:line), the serialization shape, and any surprises. If the answer is bigger, capture details with `prjct remember learning '<summary>'` and reply with the mem id + headline."
54
67
 
68
+ ### Why this is also a prompt-cache + token win (not just hygiene)
69
+
70
+ Pointing instead of carrying is what keeps you cheap:
71
+
72
+ - Your own window stays lean — you never absorb the files/diffs the subagents read, so the cacheable prefix of YOUR context (system + this leader prompt + prjct state) stays stable across every dispatch and gets reused turn after turn.
73
+ - Each subagent reads project state in ITS OWN fresh window via the `prjct` commands you name — that read is local to it and thrown away when it returns its one-screen summary. Nothing flows back into your context except the summary.
74
+ - Keep dispatch prompts **structurally identical** across implementers (same skeleton: role line → the `prjct` commands to run → the disjoint scope → the output format). Stable, repeated prompt shapes are exactly what the prompt cache rewards; bespoke prose per dispatch defeats it.
75
+
76
+ Burning tokens looks like: pasting file contents or task/plan/memory bodies into a dispatch, echoing a subagent's full transcript back to the user, or re-reading the same files in your own window that a subagent already read. Don't do any of those.
77
+
55
78
  ## Session close protocol
56
79
 
57
80
  When the reviewer replies `VERDICT: APPROVED`:
58
81
 
59
- 1. Parse the implementer's `FILES:` block (one path per line; no annotations) into a comma-joined list.
60
- 2. Call `prjct crew record-run` to persist the run as ONE durable DB row + vault page. Idempotent on `--run-id` (so a retry with the same id is safe):
82
+ 1. Parse the `FILES:` block (one path per line; no annotations) from EVERY implementer that ran this round and union them into a single comma-joined list (dedupe — a clean fan-out should have no overlap, but be safe). Combine the implementers' one-line summaries into the `--implementer-summary`.
83
+ 2. Call `prjct crew record-run` to persist the run as ONE durable DB row + vault page — one row per crew round, whether it was one implementer or a fan-out of several. Idempotent on `--run-id` (so a retry with the same id is safe):
61
84
 
62
85
  ```
63
86
  prjct crew record-run \
@@ -76,12 +99,15 @@ If the reviewer replies `VERDICT: CHANGES_REQUESTED`, do not call `record-run` f
76
99
 
77
100
  ## Effort scaling
78
101
 
79
- | Complexity | Subagents |
80
- |----------------------------|---------------------------------------------------|
81
- | Trivial (1 file) | 1 implementer |
82
- | Standard (2-3 files) | 1 implementer + 1 reviewer |
83
- | Refactor / cross-cutting | 2-3 explorers → 1 implementer 1 reviewer |
84
- | Very complex | Split into prjct subtasks; recurse per subtask |
102
+ | Complexity | Subagents |
103
+ |-----------------------------------------|------------------------------------------------------------|
104
+ | Trivial (1 file) | 1 implementer |
105
+ | Standard (2-3 files) | 1 implementer + 1 reviewer |
106
+ | Independent subtasks (disjoint files) | N implementers IN PARALLEL → 1 reviewer over combined diff |
107
+ | Refactor / cross-cutting | 2-3 explorers implementer(s) 1 reviewer |
108
+ | Very complex | Split into prjct subtasks; recurse per subtask |
109
+
110
+ Match the implementer count to the work. One subtask → one implementer. Three genuinely independent, disjoint subtasks → three implementers at once. Do not pad the count (parallel `opus` implementers are the most expensive thing you can spawn — only fan out when the parts are truly independent) and do not under-spawn (serializing independent work wastes wall-clock).
85
111
 
86
112
  ## What you do NOT do
87
113
 
@@ -286,6 +286,10 @@ Workflows that read many files (`review`, `security`, `investigate`, `audit`) MU
286
286
 
287
287
  In every non-implementer subagent prompt, add one line: "Apply decent, not exhaustive, effort — you are reviewing/orchestrating: return the verdict, do not over-deliberate." Effort is prompt guidance (the Agent tool has no effort param); `model:` is the concrete lever — never omit it for a non-implementer.
288
288
 
289
+ **Fan out implementers when subtasks are independent.** One implementer is the floor, not a cap. When work splits into 2+ parts that touch DISJOINT files, dispatch one `implementer` per part IN THE SAME MESSAGE (one Agent block each) so they run in parallel — each `model: "opus"`, each handed its own non-overlapping file scope by you. If you cannot carve disjoint scopes (two parts would edit the same file), do NOT parallelize — run them sequentially; parallel writes to one file clobber each other. After the fan-out returns, ONE reviewer validates the combined diff (not one reviewer per implementer). Only fan out for genuine independence — parallel `opus` implementers are the most expensive spawn, so match the count to the work, never pad it.
290
+
291
+ **Crew mode reconciliation.** If this project has crew mode installed (`.claude/agents/leader.md` present, or a `prjct:crew` block in CLAUDE.md), the TRIAGE-FIRST "go direct" rule does NOT mean the main session writes code itself — it means triage happens INSIDE the leader: a trivial change is a 1-implementer dispatch (no spec), not a reason to skip the crew. In a crew project, ANY code/test work routes through the leader → implementer(s) → reviewer; the main session never edits source directly. "Go direct" still governs non-code turns (captures, memory, Q&A) — those need no subagent at all.
292
+
289
293
  Dispatch pattern:
290
294
 
291
295
  1. Parent collects diff scope (`git diff <base>...HEAD --name-only` — git, not prjct state) and identifies the memory TOPIC the subagent should pull (it does not pull it itself).