@wrongstack/core 0.307.0 → 0.307.1

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.
@@ -3263,6 +3263,7 @@ var RUNTIME_CAPABILITY_MANIFEST = [
3263
3263
  "codebase-skeleton",
3264
3264
  "codebase-repo-map",
3265
3265
  "codebase-impact-analysis",
3266
+ "codebase-invariant-check",
3266
3267
  "dead-code-scan",
3267
3268
  "diff",
3268
3269
  "json",
@@ -4292,13 +4293,50 @@ var HEAVY_BUDGET = {
4292
4293
  maxIterations: 8e3,
4293
4294
  maxToolCalls: 2e4
4294
4295
  };
4296
+ var INDEX_READ = [
4297
+ "codebase-stats",
4298
+ "codebase-search",
4299
+ "codebase-skeleton",
4300
+ "codebase-repo-map",
4301
+ "codebase-incoming-calls",
4302
+ "codebase-outgoing-calls"
4303
+ ];
4295
4304
  var TOOLS = {
4305
+ /** Index-backed code discovery. Spread onto code-facing presets, not browser. */
4306
+ index: INDEX_READ,
4296
4307
  /** Pure read/inspect — safe for analysis and review agents. */
4297
4308
  read: ["read", "grep", "glob", "search", "tree", "mailbox"],
4298
4309
  /** Read + structured inspection (logs, diffs, json, dependency audit). */
4299
- inspect: ["read", "grep", "glob", "search", "tree", "json", "diff", "logs", "audit", "mailbox"],
4310
+ inspect: [
4311
+ "read",
4312
+ "grep",
4313
+ "glob",
4314
+ "search",
4315
+ "tree",
4316
+ ...INDEX_READ,
4317
+ "json",
4318
+ "diff",
4319
+ "logs",
4320
+ "audit",
4321
+ "mailbox"
4322
+ ],
4300
4323
  /** Read + edit (no shell). For agents that write code/docs but don't run it. */
4301
- write: ["read", "grep", "glob", "search", "tree", "write", "edit", "replace", "patch", "mailbox"],
4324
+ write: [
4325
+ "read",
4326
+ "grep",
4327
+ "glob",
4328
+ "search",
4329
+ "tree",
4330
+ ...INDEX_READ,
4331
+ "codebase-impact-analysis",
4332
+ "codebase-ast-replace",
4333
+ "codebase-invariant-check",
4334
+ "write",
4335
+ "edit",
4336
+ "replace",
4337
+ "patch",
4338
+ "mailbox"
4339
+ ],
4302
4340
  /** Full build loop: edit + run (lint/format/typecheck/test/bash). */
4303
4341
  build: [
4304
4342
  "read",
@@ -4306,6 +4344,11 @@ var TOOLS = {
4306
4344
  "glob",
4307
4345
  "search",
4308
4346
  "tree",
4347
+ ...INDEX_READ,
4348
+ "codebase-impact-analysis",
4349
+ "codebase-ast-replace",
4350
+ "codebase-invariant-check",
4351
+ "codebase-targeted-test",
4309
4352
  "diff",
4310
4353
  "write",
4311
4354
  "edit",
@@ -4332,7 +4375,18 @@ var TOOLS = {
4332
4375
  /** Dependency management + CVE audit. */
4333
4376
  deps: ["read", "grep", "glob", "install", "outdated", "audit", "json", "mailbox"],
4334
4377
  /** Documentation authoring. */
4335
- docs: ["read", "grep", "glob", "search", "tree", "write", "edit", "document", "mailbox"],
4378
+ docs: [
4379
+ "read",
4380
+ "grep",
4381
+ "glob",
4382
+ "search",
4383
+ "tree",
4384
+ ...INDEX_READ,
4385
+ "write",
4386
+ "edit",
4387
+ "document",
4388
+ "mailbox"
4389
+ ],
4336
4390
  /** Web research. */
4337
4391
  research: ["read", "grep", "glob", "search", "fetch", "mailbox"]
4338
4392
  };
@@ -4349,7 +4403,7 @@ var DISCOVERY_AGENTS = [
4349
4403
  id: "explore",
4350
4404
  name: "Explore",
4351
4405
  role: "explore",
4352
- tools: [...TOOLS.read],
4406
+ tools: [...TOOLS.read, ...TOOLS.index],
4353
4407
  prompt: agentPrompt("explore")
4354
4408
  },
4355
4409
  budget: MEDIUM_BUDGET,
@@ -4377,7 +4431,7 @@ var DISCOVERY_AGENTS = [
4377
4431
  id: "search",
4378
4432
  name: "Search",
4379
4433
  role: "search",
4380
- tools: [...TOOLS.read, "codebase-search"],
4434
+ tools: [...TOOLS.read, ...TOOLS.index],
4381
4435
  prompt: agentPrompt("search")
4382
4436
  },
4383
4437
  budget: MEDIUM_BUDGET,
@@ -4428,7 +4482,7 @@ var DISCOVERY_AGENTS = [
4428
4482
  ];
4429
4483
 
4430
4484
  // src/coordination/agents/phase2-planning.ts
4431
- var PLAN_TOOLS = [...TOOLS.read, "plan", "todo"];
4485
+ var PLAN_TOOLS = [...TOOLS.read, ...TOOLS.index, "plan", "todo"];
4432
4486
  var PLANNING_AGENTS = [
4433
4487
  {
4434
4488
  config: {
@@ -24,7 +24,7 @@ export declare const RUNTIME_CAPABILITY_MANIFEST: readonly [{
24
24
  readonly id: 'code.inspect';
25
25
  readonly pack: 'core';
26
26
  readonly exposure: 'direct';
27
- readonly tools: readonly ["codebase-stats", "codebase-search", "codebase-incoming-calls", "codebase-outgoing-calls", "codebase-index", "codebase-skeleton", "codebase-repo-map", "codebase-impact-analysis", "dead-code-scan", "diff", "json", "logs"];
27
+ readonly tools: readonly ["codebase-stats", "codebase-search", "codebase-incoming-calls", "codebase-outgoing-calls", "codebase-index", "codebase-skeleton", "codebase-repo-map", "codebase-impact-analysis", "codebase-invariant-check", "dead-code-scan", "diff", "json", "logs"];
28
28
  }, {
29
29
  readonly id: 'filesystem.write';
30
30
  readonly pack: 'development';
@@ -20,6 +20,8 @@ Output: Markdown architecture doc:
20
20
 
21
21
  Working rules:
22
22
  - Follow the repo's existing layering; never introduce a reverse dependency
23
+ - Orient with `codebase-repo-map` and `codebase-search` before proposing new modules
24
+ - Use `codebase-skeleton` to read existing contracts instead of guessing them
23
25
  - Prefer the simplest design that meets the requirement — no speculative generality
24
26
  - Make every interface explicit as a type signature
25
27
  - Record why each non-obvious decision was made
@@ -22,6 +22,7 @@ Output: Markdown review:
22
22
 
23
23
  Working rules:
24
24
  - Read-only — review and recommend, never edit
25
+ - Prefer `codebase-search` / `codebase-incoming-calls` to confirm call sites and duplicates before calling a change isolated
25
26
  - Lead with correctness; don't bury a real bug under style nits
26
27
  - Every finding needs file:line and a concrete suggestion
27
28
  - Cite the project convention you're invoking, don't assert taste
@@ -18,6 +18,8 @@ Output: Markdown debug report:
18
18
 
19
19
  Working rules:
20
20
  - Find the root cause before fixing — never patch the symptom
21
+ - Locate the failing symbol with `codebase-search`, then `codebase-incoming-calls` / `codebase-outgoing-calls` before grepping
22
+ - After the fix, prefer `codebase-targeted-test` for covering suites, then widen only if needed
21
23
  - Add a regression test that fails before the fix and passes after
22
24
  - Make the smallest fix that addresses the cause
23
25
  - If you can't reproduce, say so and report what you'd need
@@ -18,6 +18,8 @@ Output: Markdown change report:
18
18
 
19
19
  Working rules:
20
20
  - Don't add features, refactors, or abstractions beyond the task
21
+ - Locate existing helpers with `codebase-search` before writing a new one
22
+ - After a focused change, prefer `codebase-targeted-test` over a full suite
21
23
  - Match the surrounding code style; don't reformat unrelated lines
22
24
  - Always run the relevant checks before reporting done
23
25
  - If the spec is ambiguous, implement the most conservative interpretation and note it
@@ -19,5 +19,7 @@ Output: Markdown map with sections:
19
19
  Working rules:
20
20
  - Read-only — never edit, write, or run shell commands
21
21
  - Always cite file:line; never describe code you haven't read
22
- - Prefer breadth first (glob/tree), then depth (read) on the hottest files
22
+ - Prefer index-first discovery: `codebase-stats` once if needed, then `codebase-repo-map` and `codebase-search` before `glob`/`tree`/`grep`
23
+ - Use `codebase-skeleton` to outline hot files; `read` only when you need the implementation
24
+ - Use `grep`/`glob`/`tree` as fallback for exact text, path patterns, or when the index is unavailable
23
25
  - If the question is ambiguous, state your interpretation before answering
@@ -19,6 +19,8 @@ Output: Markdown refactor report:
19
19
 
20
20
  Working rules:
21
21
  - Behavior must not change — run the existing tests before and after
22
+ - Before moving or renaming a symbol, run `codebase-impact-analysis` and `codebase-incoming-calls`
23
+ - Prefer `codebase-ast-replace` for surgical body updates; run `codebase-invariant-check` when the public contract must stay compatible
22
24
  - Refactor in small, independently-valid steps; keep it green between steps
23
25
  - Never mix a refactor with a behavior change in the same pass
24
26
  - Distinct from Simplifier: you change structure, not just reduce complexity
@@ -20,6 +20,7 @@ Output: Markdown review:
20
20
 
21
21
  Working rules:
22
22
  - Read-only: never edit files or run mutating commands
23
+ - Prefer `codebase-search` / `codebase-incoming-calls` over broad `grep` when checking usages and blast radius
23
24
  - Treat "tests not run" or vague verification as a finding
24
25
  - Every blocking finding needs a file:line or a reproducible missing check
25
26
  - If you cannot prove a claim, mark it as uncertain and say what would prove it
@@ -16,6 +16,10 @@ self-contained handoff; do not take over fleet orchestration.
16
16
  provides, and write it yourself only when none of them fit — then write the
17
17
  smallest version. A new dependency needs an explicit grant. The ladder trims
18
18
  code you invented; it never shrinks the assigned deliverable.
19
+ <!--ws:if tool=codebase-search-->
20
+ Confirm the repo does not already do it with `codebase-search` before writing
21
+ a new helper.
22
+ <!--ws:end-->
19
23
  - Routine project-local reads, edits, and verification are pre-authorized when
20
24
  the task permits implementation. Review, research, diagnosis, and planning
21
25
  assignments remain read-only.
@@ -28,13 +32,21 @@ self-contained handoff; do not take over fleet orchestration.
28
32
  1. Restate the deliverable internally and identify the smallest evidence needed
29
33
  to establish it.
30
34
  2. Inspect the relevant surface and its direct contracts before acting.
35
+ <!--ws:if tool=codebase-search-->
36
+ Locate code with `codebase-search` before broad `grep`/`glob`/`tree`.
37
+ <!--ws:end-->
31
38
  3. Execute the smallest coherent solution or investigation.
32
39
  4. Verify the exact behavior with the narrowest meaningful check, broadening
33
40
  only when dependency or platform risk warrants it.
41
+ <!--ws:if tool=codebase-targeted-test-->
42
+ After a focused mutation, prefer `codebase-targeted-test` over a full suite.
43
+ <!--ws:end-->
34
44
  5. Inspect your own diff or evidence for scope drift, hidden failures, and
35
45
  unsupported claims.
36
46
  6. Report complete, partial, or blocked status honestly. Do not call work done
37
47
  because a nearby test passed or time is running low.
48
+ If three tool rounds produce no new evidence, stop and return
49
+ `completion:"partial"` with what you tried and what still blocks you.
38
50
 
39
51
  Respect the current working directory. If the Director gives you an isolated
40
52
  git worktree, all reads, writes, and build commands for the task belong in that
@@ -45,13 +57,60 @@ deletion, history rewriting, force-push, or database destruction unless the
45
57
  task explicitly requires the action and identifies the exact target. Recheck
46
58
  the target before any destructive step.
47
59
 
60
+ <!--ws:if tool=codebase-search,codebase-stats,codebase-skeleton,codebase-repo-map,codebase-incoming-calls,codebase-outgoing-calls,codebase-impact-analysis-->
48
61
  ## Codebase discovery
49
62
 
50
- When the index is available, use it before broad `grep`/`glob` exploration:
51
- - `codebase-search` to locate symbols, definitions, and candidate modules.
52
- - `codebase-incoming-calls` to find all callers of a symbol before refactoring.
53
- - `codebase-outgoing-calls` to understand a symbol's dependencies.
54
- Read source files returned by search before relying on them.
63
+ Index tools registered for this task are the default path. Do not start with
64
+ broad `grep`/`glob`/`tree` when they can answer.
65
+
66
+ <!--ws:if tool=codebase-stats-->
67
+ 1. **Check once** with `codebase-stats` if you need to know whether a persisted index exists.
68
+ <!--ws:end-->
69
+ <!--ws:if tool=codebase-search-->
70
+ 2. **Search first** with `codebase-search` for symbols, definitions, concepts, and candidate modules.
71
+ <!--ws:end-->
72
+ <!--ws:if tool=codebase-repo-map-->
73
+ 3. **Orient once** with `codebase-repo-map` on an unfamiliar or repository-wide slice.
74
+ <!--ws:end-->
75
+ <!--ws:if tool=codebase-skeleton-->
76
+ 4. **Outline before a deep read** with `codebase-skeleton` when you only need signatures, types, or exports.
77
+ <!--ws:end-->
78
+ <!--ws:if tool=codebase-incoming-calls-->
79
+ 5. **Find callers** with `codebase-incoming-calls` before refactoring or changing a symbol — not `grep`.
80
+ <!--ws:end-->
81
+ <!--ws:if tool=codebase-outgoing-calls-->
82
+ 6. **Find callees** with `codebase-outgoing-calls` to see what the symbol depends on.
83
+ <!--ws:end-->
84
+ <!--ws:if tool=codebase-impact-analysis-->
85
+ 7. **Measure blast radius** with `codebase-impact-analysis` before a signature or type change.
86
+ <!--ws:end-->
87
+ Read returned source before relying on a hit. Fall back to `grep` only for exact
88
+ text, regexes, or content the index cannot represent.
89
+ <!--ws:else-->
90
+ <!--ws:if tool=grep,glob,tree,read-->
91
+ ## Codebase discovery
92
+
93
+ No index tools are registered for this task. Use {{tools:grep,glob,tree,read}}
94
+ for exact text, paths, and the files you will rely on.
95
+ <!--ws:end-->
96
+ <!--ws:end-->
97
+
98
+ <!--ws:if tool=codebase-ast-replace,codebase-invariant-check,codebase-targeted-test,edit,write,patch-->
99
+ ## Mutation and verification
100
+
101
+ <!--ws:if tool=codebase-ast-replace-->
102
+ - Prefer `codebase-ast-replace` when replacing an existing function, method, or class body.
103
+ <!--ws:end-->
104
+ <!--ws:if tool=codebase-invariant-check-->
105
+ - Run `codebase-invariant-check` before a signature or export change that must stay compatible.
106
+ <!--ws:end-->
107
+ <!--ws:if tool=edit,write,patch-->
108
+ - Otherwise edit surgically with {{tools:edit,write,patch}}; do not rewrite a file to change one symbol.
109
+ <!--ws:end-->
110
+ <!--ws:if tool=codebase-targeted-test-->
111
+ - After the change, run `codebase-targeted-test` for the touched symbol or file before widening to the full suite.
112
+ <!--ws:end-->
113
+ <!--ws:end-->
55
114
 
56
115
  ## No further delegation
57
116
 
@@ -107,6 +166,7 @@ write stable, task-specific artifacts. Treat sibling notes as unverified input.
107
166
  Do not overwrite another worker's owned file or use shared notes as a
108
167
  substitute for the final result.
109
168
 
169
+ <!--ws:if tool=mailbox,mail_send,mail_inbox-->
110
170
  ## Mailbox protocol
111
171
 
112
172
  When mail tools are available:
@@ -122,6 +182,7 @@ When mail tools are available:
122
182
  expose sensitive findings or flood the fleet with routine progress.
123
183
  - Mail may be injected for one evaluation and then removed. Retain only the
124
184
  concise conclusion or action needed later; do not quote raw messages.
185
+ <!--ws:end-->
125
186
 
126
187
  ## Result contract
127
188
 
@@ -6,6 +6,9 @@
6
6
  <!--ws:if tool=codebase-search tool=read tool=edit tool=grep-->
7
7
  - **Inspect before edit:** live `codebase-search` -> `read` target -> `edit`; use `grep` for exact-text confirmation
8
8
  <!--ws:end-->
9
+ <!--ws:if tool=codebase-search tool=grep-->
10
+ - **Index before grep:** prefer live `codebase-search` for symbols and concepts; reserve `grep` for exact strings, regexes, and non-indexed content
11
+ <!--ws:end-->
9
12
  <!--ws:if tool=codebase-skeleton tool=read-->
10
13
  - **Outline before deep read:** use `codebase-skeleton` to inspect module contracts and function signatures first; `read` full files only when exact implementation details are required
11
14
  <!--ws:end-->
@@ -21,6 +24,12 @@
21
24
  <!--ws:if tool=codebase-ast-replace tool=codebase-targeted-test-->
22
25
  - **Mutate and self-heal:** use `codebase-ast-replace` for surgical code edits, followed immediately by `codebase-targeted-test` to verify affected suites in milliseconds
23
26
  <!--ws:end-->
27
+ <!--ws:if tool=codebase-invariant-check tool=codebase-ast-replace-->
28
+ - **Invariants before a breaking signature change:** run `codebase-invariant-check` on the candidate; apply `codebase-ast-replace` only when valid or when breaking is intentional
29
+ <!--ws:end-->
30
+ <!--ws:if tool=codebase-incoming-calls tool=codebase-outgoing-calls-->
31
+ - **Call graph before refactor:** `codebase-incoming-calls` for callers, `codebase-outgoing-calls` for dependencies; do not start with `grep`
32
+ <!--ws:end-->
24
33
  <!--ws:if tool=security-ast-scan-->
25
34
  - **Security & performance gate:** run `security-ast-scan` on newly introduced database queries or user inputs to prevent SQL injection, N+1 performance bottlenecks, or prototype pollution
26
35
  <!--ws:end-->
@@ -111,11 +111,14 @@ Use `codebase-stats` once before broad code discovery when available.
111
111
  Use `clarify` only on irreversible forks; otherwise autonomously adopt industry best practices and keep moving.
112
112
  <!--ws:end-->
113
113
  <!--ws:if tool=codebase-search-->
114
- Use `codebase-search` to locate symbols, definitions, concepts, and likely modules.
114
+ Prefer `codebase-search` before `grep`, `glob`, or `tree` for symbols and concepts. Use `grep` only for exact text or regex.
115
115
  <!--ws:end-->
116
116
  <!--ws:if tool=codebase-skeleton-->
117
117
  Use `codebase-skeleton` to inspect signatures, types, and module contracts without reading whole files.
118
118
  <!--ws:end-->
119
+ <!--ws:if tool=codebase-invariant-check-->
120
+ Use `codebase-invariant-check` before applying a signature or export change that must stay compatible.
121
+ <!--ws:end-->
119
122
  <!--ws:if tool=codebase-repo-map-->
120
123
  Use `codebase-repo-map` to generate a token-budgeted repository outline across key modules.
121
124
  <!--ws:end-->
@@ -260,14 +260,14 @@ No task-tracking tool is registered in this request. Keep multi-step work visibl
260
260
 
261
261
  Your capabilities arrive as tool groups, each with a distinct purpose. The groups below are the ones registered for **this** request; a group whose tools are absent is omitted rather than described. The live provider tool definitions remain authoritative for exact names and parameters.
262
262
 
263
- <!--ws:if tool=read,edit,write,patch,replace,glob,grep,tree,diff,json,logs,clarify,codebase-search,codebase-incoming-calls,codebase-outgoing-calls,codebase-skeleton,codebase-repo-map,codebase-ast-replace,codebase-impact-analysis-->
263
+ <!--ws:if tool=read,edit,write,patch,replace,glob,grep,tree,diff,json,logs,clarify,codebase-search,codebase-incoming-calls,codebase-outgoing-calls,codebase-skeleton,codebase-repo-map,codebase-ast-replace,codebase-impact-analysis,codebase-invariant-check-->
264
264
  ### Filesystem & Project insight
265
- {{tools:read,edit,write,patch,replace,glob,grep,tree,diff,json,logs,clarify,codebase-ast-replace,codebase-impact-analysis}}
265
+ {{tools:read,edit,write,patch,replace,glob,grep,tree,diff,json,logs,clarify,codebase-ast-replace,codebase-impact-analysis,codebase-invariant-check}}
266
266
  <!--ws:if tool=clarify-->
267
267
  - `clarify` only when an architectural fork is truly irreversible or destructive with no obvious standard default. Otherwise, autonomously apply industry best practices, advance through next steps, and state decisions in your final response.
268
268
  <!--ws:end-->
269
269
  <!--ws:if tool=codebase-search-->
270
- - Prefer `codebase-search` before broad text exploration for code understanding.
270
+ - Prefer `codebase-search` before broad `grep`/`glob`/`tree` exploration for code understanding.
271
271
  <!--ws:else-->
272
272
  <!--ws:if tool=grep,glob-->
273
273
  - Use the registered exact-text or path discovery tools above as appropriate.
@@ -285,6 +285,9 @@ Your capabilities arrive as tool groups, each with a distinct purpose. The group
285
285
  <!--ws:if tool=codebase-impact-analysis-->
286
286
  - `codebase-impact-analysis` to calculate blast radius and discover all affected call sites and test suites before modifying function signatures or types.
287
287
  <!--ws:end-->
288
+ <!--ws:if tool=codebase-invariant-check-->
289
+ - `codebase-invariant-check` to verify a candidate mutation is backward-compatible before applying it.
290
+ <!--ws:end-->
288
291
  <!--ws:if tool=tree-->
289
292
  - `tree` for directory layout.
290
293
  <!--ws:end-->
@@ -574,6 +577,12 @@ Before discovery on an unfamiliar area:
574
577
  When the request requires understanding or locating code:
575
578
  1. **Check once:** Call `codebase-stats` when live before broad exploration. `totalFiles: 0` together with `lastIndexed: null` means there is no usable persisted index. If `codebase-stats` is absent, call `codebase-search` and inspect its `indexStatus`.
576
579
  2. **Use the index first:** With a usable index, start with `codebase-search`, then read the returned files. Refine with its `kind`, `lang`, and `file` filters before widening the search.
580
+ <!--ws:if tool=codebase-repo-map-->
581
+ On an unfamiliar or repository-wide task, call `codebase-repo-map` once before walking directories.
582
+ <!--ws:end-->
583
+ <!--ws:if tool=codebase-skeleton-->
584
+ Prefer `codebase-skeleton` over a full `read` when you only need signatures, types, or exports.
585
+ <!--ws:end-->
577
586
  3. **Create it when missing:** If stats or search reports no persisted index, call live `codebase-index` with its default incremental mode, then retry `codebase-search`. Use a forced rebuild only for a corrupt/stale index or when explicitly needed.
578
587
  4. **Degrade without blocking:** If indexing is already running, unavailable, denied, failed, or cannot represent the target content, continue with the best-fit fallback instead of looping or waiting indefinitely.
579
588
  5. **Use precise fallbacks:** Use `grep` for exact strings, regexes, config/docs, generated or unsupported languages, and concrete usage sites; use `glob` for paths. Index hits are navigation hints, so read the source before editing.
@@ -597,12 +606,28 @@ recall → locate → assess impact → read → edit → read back → verify
597
606
  <!--ws:else-->
598
607
  3. **Assess impact** by grepping for every call site before changing a signature
599
608
  <!--ws:end-->
609
+ <!--ws:if tool=codebase-impact-analysis-->
610
+ Before changing a signature or type, run `codebase-impact-analysis`.
611
+ <!--ws:end-->
600
612
  4. **Read** the relevant files before changing anything
613
+ <!--ws:if tool=codebase-skeleton-->
614
+ Prefer `codebase-skeleton` when you only need the contract, not the body.
615
+ <!--ws:end-->
601
616
  5. **Edit** surgically with `edit` (preferred) or `write` (new files only)
617
+ <!--ws:if tool=codebase-ast-replace-->
618
+ Prefer `codebase-ast-replace` when replacing an existing function, method, or class body.
619
+ <!--ws:end-->
620
+ <!--ws:if tool=codebase-invariant-check-->
621
+ Run `codebase-invariant-check` before a signature change if compatibility matters.
622
+ <!--ws:end-->
602
623
  6. **Read** the result back to confirm correctness
624
+ <!--ws:if tool=codebase-targeted-test-->
625
+ 7. **Verify** with `codebase-targeted-test` for the changed symbol or file, then {{tools:lint,typecheck,test}} as appropriate
626
+ <!--ws:else-->
603
627
  <!--ws:if tool=lint,typecheck,test-->
604
628
  7. **Verify** with {{tools:lint,typecheck,test}} as appropriate
605
629
  <!--ws:end-->
630
+ <!--ws:end-->
606
631
  <!--ws:if tool=remember-->
607
632
  8. **Record** anything durable you learned (`remember`)
608
633
 
@@ -192,18 +192,33 @@ No task-tracking tool is registered in this request. Keep multi-step work visibl
192
192
 
193
193
  Your capabilities arrive as tool groups, each with a distinct purpose. The groups below are the ones registered for **this** request; a group whose tools are absent is omitted rather than described. The live provider tool definitions remain authoritative for exact names and parameters.
194
194
 
195
- <!--ws:if tool=read,edit,write,patch,replace,glob,grep,tree,diff,json,logs,codebase-search,codebase-incoming-calls,codebase-outgoing-calls-->
195
+ <!--ws:if tool=read,edit,write,patch,replace,glob,grep,tree,diff,json,logs,codebase-search,codebase-incoming-calls,codebase-outgoing-calls,codebase-skeleton,codebase-repo-map,codebase-ast-replace,codebase-impact-analysis,codebase-invariant-check-->
196
196
  ### Filesystem & Project insight
197
- {{tools:read,edit,write,patch,replace,glob,grep,tree,diff,json,logs}}
197
+ {{tools:read,edit,write,patch,replace,glob,grep,tree,diff,json,logs,codebase-ast-replace,codebase-impact-analysis,codebase-invariant-check}}
198
198
  <!--ws:if tool=codebase-search-->
199
- - Prefer `codebase-search` before broad text exploration for code understanding.
199
+ - Prefer `codebase-search` before broad `grep`/`glob`/`tree` exploration for code understanding.
200
200
  <!--ws:else-->
201
201
  <!--ws:if tool=grep,glob-->
202
202
  - Use the registered exact-text or path discovery tools above as appropriate.
203
203
  <!--ws:end-->
204
204
  <!--ws:end-->
205
+ <!--ws:if tool=codebase-skeleton-->
206
+ - `codebase-skeleton` to inspect signatures, types, and exports before a full `read`.
207
+ <!--ws:end-->
208
+ <!--ws:if tool=codebase-repo-map-->
209
+ - `codebase-repo-map` once at the start of an unfamiliar or repository-wide task.
210
+ <!--ws:end-->
211
+ <!--ws:if tool=codebase-ast-replace-->
212
+ - `codebase-ast-replace` for surgical function/method/class replacement without string-matching errors.
213
+ <!--ws:end-->
214
+ <!--ws:if tool=codebase-impact-analysis-->
215
+ - `codebase-impact-analysis` to map blast radius before changing a signature or type.
216
+ <!--ws:end-->
217
+ <!--ws:if tool=codebase-invariant-check-->
218
+ - `codebase-invariant-check` to verify a candidate mutation is backward-compatible before applying it.
219
+ <!--ws:end-->
205
220
  <!--ws:if tool=tree-->
206
- - `tree` for directory layout.
221
+ - `tree` for directory layout, not for finding symbols.
207
222
  <!--ws:end-->
208
223
  <!--ws:if tool=codebase-incoming-calls,codebase-outgoing-calls-->
209
224
  - Use `codebase-incoming-calls` to find all callers of a symbol before refactoring — instant, exact, no grep needed. Use `codebase-outgoing-calls` to see what a symbol depends on.
@@ -219,10 +234,13 @@ Your capabilities arrive as tool groups, each with a distinct purpose. The group
219
234
  <!--ws:end-->
220
235
  <!--ws:end-->
221
236
 
222
- <!--ws:if tool=lint,format,typecheck,test,e2e_plan,language,language_info,language_package-->
237
+ <!--ws:if tool=lint,format,typecheck,test,codebase-targeted-test,e2e_plan,language,language_info,language_package-->
223
238
  ### Code quality
224
- {{tools:lint,format,typecheck,test,e2e_plan,language,language_info,language_package}}
239
+ {{tools:lint,format,typecheck,test,codebase-targeted-test,e2e_plan,language,language_info,language_package}}
225
240
  - Run the narrowest appropriate verification from the tools above before calling changed code complete.
241
+ <!--ws:if tool=codebase-targeted-test-->
242
+ - `codebase-targeted-test` immediately after mutating a symbol or file — run only the covering suites.
243
+ <!--ws:end-->
226
244
  <!--ws:if tool=test-->
227
245
  - `test` with `files`/`grep` to scope to relevant tests.
228
246
  <!--ws:end-->
@@ -397,9 +415,9 @@ A worker that realizes its task will run long should mail the leader (type `stee
397
415
  <!--ws:end-->
398
416
  <!--ws:end-->
399
417
 
400
- <!--ws:if tool=design,scaffold,codebase-index,codebase-search,codebase-incoming-calls,codebase-outgoing-calls,codebase-stats,e2e_plan-->
418
+ <!--ws:if tool=design,scaffold,codebase-index,codebase-search,codebase-skeleton,codebase-repo-map,codebase-incoming-calls,codebase-outgoing-calls,codebase-stats,e2e_plan-->
401
419
  ### Config & Project
402
- {{tools:design,scaffold,codebase-index,codebase-search,codebase-incoming-calls,codebase-outgoing-calls,codebase-stats,e2e_plan}}
420
+ {{tools:design,scaffold,codebase-index,codebase-search,codebase-skeleton,codebase-repo-map,codebase-incoming-calls,codebase-outgoing-calls,codebase-stats,e2e_plan}}
403
421
  <!--ws:if tool=design-->
404
422
  - `design` to load/pin UI design kits and extract token palettes.
405
423
  <!--ws:end-->
@@ -415,6 +433,12 @@ A worker that realizes its task will run long should mail the leader (type `stee
415
433
  <!--ws:if tool=codebase-search-->
416
434
  - `codebase-search` as the first search for indexed code symbols, concepts, definitions, and candidate modules.
417
435
  <!--ws:end-->
436
+ <!--ws:if tool=codebase-skeleton-->
437
+ - `codebase-skeleton` to extract signatures and types with bodies stripped before reading a large file.
438
+ <!--ws:end-->
439
+ <!--ws:if tool=codebase-repo-map-->
440
+ - `codebase-repo-map` to generate a token-budgeted architecture outline across key modules.
441
+ <!--ws:end-->
418
442
  <!--ws:if tool=codebase-incoming-calls-->
419
443
  - `codebase-incoming-calls` to find all callers of a symbol — use BEFORE refactoring or changing any function; prefer it over grep when the index is available, and fall back to grep when the index is cold/unavailable or for dynamic dispatch.
420
444
  <!--ws:end-->
@@ -462,6 +486,12 @@ Tools are not isolated — they form pipelines. Coordinate them with these princ
462
486
  When the request requires understanding or locating code:
463
487
  1. **Check once:** Call `codebase-stats` when live before broad exploration. `totalFiles: 0` together with `lastIndexed: null` means there is no usable persisted index. If `codebase-stats` is absent, call `codebase-search` and inspect its `indexStatus`.
464
488
  2. **Use the index first:** With a usable index, start with `codebase-search`, then read the returned files. Refine with its `kind`, `lang`, and `file` filters before widening the search.
489
+ <!--ws:if tool=codebase-repo-map-->
490
+ On an unfamiliar or repository-wide task, call `codebase-repo-map` once before walking directories.
491
+ <!--ws:end-->
492
+ <!--ws:if tool=codebase-skeleton-->
493
+ Prefer `codebase-skeleton` over a full `read` when you only need signatures, types, or exports.
494
+ <!--ws:end-->
465
495
  3. **Create it when missing:** If stats or search reports no persisted index, call live `codebase-index` with its default incremental mode, then retry `codebase-search`. Use a forced rebuild only for a corrupt/stale index or when explicitly needed.
466
496
  4. **Degrade without blocking:** If indexing is already running, unavailable, denied, failed, or cannot represent the target content, continue with the best-fit fallback instead of looping or waiting indefinitely.
467
497
  5. **Use precise fallbacks:** Use `grep` for exact strings, regexes, config/docs, generated or unsupported languages, and concrete usage sites; use `glob` for paths. Index hits are navigation hints, so read the source before editing.
@@ -471,10 +501,13 @@ When the request requires understanding or locating code:
471
501
  ### The read-edit loop (most common workflow)
472
502
  <!--ws:if tool=codebase-search-->
473
503
  ```
474
- codebase-stats/codebase-search → codebase-incoming-calls/outgoing-calls → grep/glob as needed → read → edit/write/patchread → verify
504
+ codebase-stats/codebase-search → codebase-incoming-calls/outgoing-calls → read → edit → verify
475
505
  ```
476
506
  1. **Locate** the target (`codebase-search` first for indexed code; otherwise the best-fit `grep` or `glob` fallback)
477
507
  2. **Assess impact** (`codebase-incoming-calls` to find all callers before editing; `codebase-outgoing-calls` to understand dependencies)
508
+ <!--ws:if tool=codebase-impact-analysis-->
509
+ Before changing a signature or type, run `codebase-impact-analysis`.
510
+ <!--ws:end-->
478
511
  <!--ws:else-->
479
512
  ```
480
513
  grep/glob → read → edit/write/patch → read → verify
@@ -484,11 +517,21 @@ grep/glob → read → edit/write/patch → read → verify
484
517
  <!--ws:end-->
485
518
  3. **Read** the relevant files before changing anything
486
519
  4. **Edit** surgically with `edit` (preferred) or `write` (new files only)
520
+ <!--ws:if tool=codebase-ast-replace-->
521
+ Prefer `codebase-ast-replace` when replacing an existing function, method, or class body.
522
+ <!--ws:end-->
523
+ <!--ws:if tool=codebase-invariant-check-->
524
+ Run `codebase-invariant-check` before a signature change if compatibility matters.
525
+ <!--ws:end-->
487
526
  5. **Read** the result back to confirm correctness
527
+ <!--ws:if tool=codebase-targeted-test-->
528
+ 6. **Verify** with `codebase-targeted-test` for the changed symbol or file, then {{tools:lint,typecheck,test}} as appropriate
529
+ <!--ws:else-->
488
530
  <!--ws:if tool=lint,typecheck,test-->
489
531
  6. **Verify** with {{tools:lint,typecheck,test}} as appropriate
490
532
  <!--ws:end-->
491
533
  <!--ws:end-->
534
+ <!--ws:end-->
492
535
 
493
536
  <!--ws:if tool=batch_tool_use,delegate,spawn_subagent,collab_debug-->
494
537
  ### Fan-out pattern (parallel work)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wrongstack/core",
3
- "version": "0.307.0",
3
+ "version": "0.307.1",
4
4
  "license": "MIT",
5
5
  "description": "WrongStack core: kernel, types, defaults, and shared utilities for the WrongStack CLI agent.",
6
6
  "repository": {
@@ -145,6 +145,10 @@
145
145
  "types": "./dist/tasking/index.d.ts",
146
146
  "import": "./dist/tasking/index.js"
147
147
  },
148
+ "./prompts": {
149
+ "types": "./dist/prompts/index.d.ts",
150
+ "import": "./dist/prompts/index.js"
151
+ },
148
152
  "./chronicle": {
149
153
  "types": "./dist/chronicle/index.d.ts",
150
154
  "import": "./dist/chronicle/index.js"
@@ -177,8 +181,8 @@
177
181
  "wrongstackApiVersion": "0.1.10",
178
182
  "dependencies": {
179
183
  "zod": "4.4.3",
180
- "@wrongstack/persistence": "0.307.0",
181
- "@wrongstack/kanban": "0.307.0"
184
+ "@wrongstack/kanban": "0.307.1",
185
+ "@wrongstack/persistence": "0.307.1"
182
186
  },
183
187
  "devDependencies": {
184
188
  "@types/node": "^26.2.0",