@wrongstack/core 0.306.4 → 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.
- package/dist/chronicle/index.js +957 -953
- package/dist/chronicle/metrics-ingest.d.ts +55 -0
- package/dist/chronicle/metrics-schema.d.ts +86 -0
- package/dist/chronicle/metrics-store.d.ts +5 -120
- package/dist/chronicle/project-server.js +1083 -1084
- package/dist/chronicle/sqlite-journal-quota.d.ts +39 -0
- package/dist/chronicle/sqlite-journal-schema.d.ts +25 -0
- package/dist/chronicle/sqlite-journal.d.ts +12 -177
- package/dist/coordination/agents/index.js +1803 -1701
- package/dist/coordination/agents/project-agent-capture.d.ts +48 -0
- package/dist/coordination/agents/project-agent-identity.d.ts +3 -129
- package/dist/coordination/agents/project-agent-roster.d.ts +17 -0
- package/dist/coordination/agents/types.d.ts +6 -9
- package/dist/coordination/index.js +6051 -5880
- package/dist/coordination/mail-tools.d.ts +1 -1
- package/dist/coordination/mailbox-http-actor-query.d.ts +16 -0
- package/dist/coordination/mailbox-http-router.d.ts +0 -48
- package/dist/coordination/mailbox-http-sse.d.ts +12 -0
- package/dist/coordination/mailbox-message-types.d.ts +71 -0
- package/dist/coordination/mailbox-predicates.d.ts +13 -0
- package/dist/coordination/mailbox-project-server.js +1 -1
- package/dist/coordination/mailbox-session-sync.d.ts +8 -0
- package/dist/coordination/mailbox-types.d.ts +6 -793
- package/dist/core/agent-loop-context.d.ts +28 -0
- package/dist/core/agent-loop-detector.d.ts +25 -0
- package/dist/core/fallback-doctor.d.ts +72 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1859 -1335
- package/dist/defaults/index.js +3647 -3559
- package/dist/execution/autonomy-brain-llm.d.ts +55 -0
- package/dist/execution/autonomy-brain.d.ts +3 -156
- package/dist/execution/compaction-budget.d.ts +38 -0
- package/dist/execution/compaction-core.d.ts +3 -170
- package/dist/execution/compaction-elision.d.ts +58 -0
- package/dist/execution/council-orchestrator-helpers.d.ts +39 -0
- package/dist/execution/council-orchestrator.d.ts +3 -42
- package/dist/execution/council-response-parser.d.ts +56 -0
- package/dist/execution/index.js +2475 -2449
- package/dist/execution/prompt-enhancer.js +11 -3
- package/dist/execution/tool-executor-guard.d.ts +18 -0
- package/dist/execution/tool-executor-runner.d.ts +12 -0
- package/dist/execution/tool-executor.d.ts +0 -75
- package/dist/goal/index.js +19 -6
- package/dist/hq/index.js +8 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8021 -7405
- package/dist/infrastructure/index.js +3 -1
- package/dist/kernel/events/agent-events.d.ts +2 -0
- package/dist/kernel/events/provider-events.d.ts +13 -0
- package/dist/plugin/index.js +2590 -2561
- package/dist/plugins/auto-review-config.d.ts +53 -0
- package/dist/plugins/auto-review-git.d.ts +19 -0
- package/dist/plugins/auto-review-plugin.d.ts +2 -140
- package/dist/plugins/review-finding-verification.d.ts +7 -0
- package/dist/prompts/index.d.ts +1 -0
- package/dist/prompts/index.js +601 -0
- package/dist/prompts/prompt-journal.d.ts +103 -0
- package/dist/security/index.js +627 -652
- package/dist/security/permission-explain.d.ts +19 -0
- package/dist/security/permission-policy.d.ts +0 -101
- package/dist/security/yolo-risk.d.ts +5 -4
- package/dist/session-catalog/index.js +220 -212
- package/dist/session-catalog/project-server.js +227 -219
- package/dist/session-catalog/store-rebuild.d.ts +9 -0
- package/dist/session-catalog/store-schema.d.ts +48 -0
- package/dist/session-catalog/store.d.ts +0 -17
- package/dist/storage/director-state.d.ts +6 -0
- package/dist/storage/file-session-writer.d.ts +2 -58
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.js +2057 -1925
- package/dist/storage/orphan-lock-cleaner.d.ts +15 -0
- package/dist/storage/queue-store.d.ts +6 -0
- package/dist/storage/session-recovery.d.ts +9 -0
- package/dist/storage/session-store/rename-session.d.ts +16 -0
- package/dist/storage/session-store/resume-session.d.ts +26 -0
- package/dist/storage/session-store/session-store-clear.d.ts +11 -0
- package/dist/storage/session-store/session-store-index.d.ts +13 -0
- package/dist/storage/session-store.d.ts +1 -129
- package/dist/storage/session-summary-tracker.d.ts +39 -0
- package/dist/storage/session-write-buffer.d.ts +43 -0
- package/dist/storage/session-writer/session-writer-flush.d.ts +4 -0
- package/dist/storage/session-writer/session-writer-summary-tracker.d.ts +28 -0
- package/dist/tools/fallback-agent-model-assign-tool.d.ts +18 -0
- package/dist/tools/fallback-leader-model-set-tool.d.ts +18 -0
- package/dist/tools/fallback-manage-tools.d.ts +8 -45
- package/dist/tools/fallback-profile-manage-tool.d.ts +16 -0
- package/dist/tools/fallback-provider-key-set-tool.d.ts +17 -0
- package/dist/tools/fallback-provider-manage-tool.d.ts +26 -0
- package/dist/tools/index.js +5124 -5071
- package/dist/types/config/root.d.ts +7 -2
- package/dist/types/default-config.d.ts +1 -1
- package/dist/types/index.d.ts +54 -55
- package/dist/types/index.js +953 -932
- package/dist/types/runtime-capability-manifest.d.ts +5 -5
- package/dist/types/session-markers.d.ts +12 -0
- package/dist/types/session-markers.js +19 -0
- package/dist/worktree/worktree-manager.d.ts +1 -1
- package/instructions/agents/architect.md +2 -0
- package/instructions/agents/code-reviewer.md +1 -0
- package/instructions/agents/debugger.md +2 -0
- package/instructions/agents/executor.md +2 -0
- package/instructions/agents/explore.md +3 -1
- package/instructions/agents/refactor.md +2 -0
- package/instructions/agents/reviewer.md +1 -0
- package/instructions/coordination/subagent-baseline.md +68 -7
- package/instructions/llm/prompt-enhancer.md +2 -1
- package/instructions/sections/tool/common-patterns.md +30 -0
- package/instructions/sections/tool/delegation-compact.md +3 -1
- package/instructions/sections/tool/delegation-full.md +5 -1
- package/instructions/system-lite.md +32 -4
- package/instructions/system-pro.md +63 -9
- package/instructions/system.md +56 -11
- package/package.json +9 -5
|
@@ -24,12 +24,12 @@ 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", "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';
|
|
31
31
|
readonly exposure: 'direct';
|
|
32
|
-
readonly tools: readonly ["write", "edit", "replace", "patch"];
|
|
32
|
+
readonly tools: readonly ["write", "edit", "replace", "patch", "codebase-ast-replace"];
|
|
33
33
|
}, {
|
|
34
34
|
readonly id: 'execution.shell';
|
|
35
35
|
readonly pack: 'development';
|
|
@@ -39,7 +39,7 @@ export declare const RUNTIME_CAPABILITY_MANIFEST: readonly [{
|
|
|
39
39
|
readonly id: 'verification.run';
|
|
40
40
|
readonly pack: 'development';
|
|
41
41
|
readonly exposure: 'direct';
|
|
42
|
-
readonly tools: readonly ["lint", "format", "typecheck", "test", "e2e_plan"];
|
|
42
|
+
readonly tools: readonly ["lint", "format", "typecheck", "test", "e2e_plan", "codebase-targeted-test"];
|
|
43
43
|
}, {
|
|
44
44
|
readonly id: 'version-control.manage';
|
|
45
45
|
readonly pack: 'development';
|
|
@@ -127,7 +127,7 @@ export declare const RUNTIME_CAPABILITY_MANIFEST: readonly [{
|
|
|
127
127
|
readonly id: 'quality.analyze';
|
|
128
128
|
readonly pack: 'development';
|
|
129
129
|
readonly exposure: 'on-demand';
|
|
130
|
-
readonly tools: readonly ["dead_code_scan", "detect_duplicate_code", "secret_scanner_test", "error_lens_history"];
|
|
130
|
+
readonly tools: readonly ["dead_code_scan", "detect_duplicate_code", "secret_scanner_test", "error_lens_history", "security-ast-scan"];
|
|
131
131
|
}, {
|
|
132
132
|
readonly id: 'release.manage';
|
|
133
133
|
readonly pack: 'development';
|
|
@@ -142,7 +142,7 @@ export declare const RUNTIME_CAPABILITY_MANIFEST: readonly [{
|
|
|
142
142
|
readonly id: 'tools.discover';
|
|
143
143
|
readonly pack: 'admin';
|
|
144
144
|
readonly exposure: 'direct';
|
|
145
|
-
readonly tools: readonly ["tool_search", "tool_use", "tool_help", "batch_tool_use"];
|
|
145
|
+
readonly tools: readonly ["tool_search", "tool_use", "tool_help", "batch_tool_use", "clarify"];
|
|
146
146
|
}, {
|
|
147
147
|
readonly id: 'runtime.admin';
|
|
148
148
|
readonly pack: 'admin';
|
|
@@ -64,4 +64,16 @@ export declare function sessionEventToMarker(ev: SessionEvent): SessionMarker |
|
|
|
64
64
|
* {@link SESSION_MARKER_EVENT_TYPES}.
|
|
65
65
|
*/
|
|
66
66
|
export declare function projectSessionMarkers(events: readonly SessionEvent[], sources?: ReadonlySet<SessionEvent['type']>): SessionMarker[];
|
|
67
|
+
/**
|
|
68
|
+
* System-injected metadata prefixes that are folded into the conversation
|
|
69
|
+
* as `user`/`system`-role messages by the agent loop at runtime (mailbox,
|
|
70
|
+
* fleet pulse, loop detector, resume validation notices) but should NOT appear
|
|
71
|
+
* in the human-facing chat history on session resume/replay.
|
|
72
|
+
*/
|
|
73
|
+
export declare const SYSTEM_INJECTION_PREFIXES: readonly string[];
|
|
74
|
+
/**
|
|
75
|
+
* Check if a text block is an internal runtime system injection that should be
|
|
76
|
+
* hidden from the human chat transcript on replay across all surfaces (TUI, WebUI, SimpleUI).
|
|
77
|
+
*/
|
|
78
|
+
export declare function isSystemInjectedMessage(text: string): boolean;
|
|
67
79
|
//# sourceMappingURL=session-markers.d.ts.map
|
|
@@ -125,9 +125,28 @@ function projectSessionMarkers(events, sources = SESSION_MARKER_EVENT_TYPES) {
|
|
|
125
125
|
}
|
|
126
126
|
return markers;
|
|
127
127
|
}
|
|
128
|
+
var SYSTEM_INJECTION_PREFIXES = [
|
|
129
|
+
"[MAILBOX]",
|
|
130
|
+
"[MAILBOX BTW]",
|
|
131
|
+
"[BY THE WAY \u2014",
|
|
132
|
+
"[QUEUED MESSAGES \u2014",
|
|
133
|
+
"[FLEET PULSE]",
|
|
134
|
+
"[loop-detector]",
|
|
135
|
+
"[SESSION RESUME FILE VALIDATION]",
|
|
136
|
+
"[SESSION RESUME INTERRUPTED WORK]"
|
|
137
|
+
];
|
|
138
|
+
function isSystemInjectedMessage(text) {
|
|
139
|
+
const trimmed = text.trimStart();
|
|
140
|
+
for (const prefix of SYSTEM_INJECTION_PREFIXES) {
|
|
141
|
+
if (trimmed.startsWith(prefix)) return true;
|
|
142
|
+
}
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
128
145
|
export {
|
|
129
146
|
CHAT_MARKER_SOURCES,
|
|
130
147
|
SESSION_MARKER_EVENT_TYPES,
|
|
148
|
+
SYSTEM_INJECTION_PREFIXES,
|
|
149
|
+
isSystemInjectedMessage,
|
|
131
150
|
projectSessionMarkers,
|
|
132
151
|
sessionEventToMarker
|
|
133
152
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AllocateOpts, MergeOpts, MergeResult, WorktreeHandle, WorktreeManagerOptions } from './worktree-types.js';
|
|
2
|
-
export type { AllocateOpts, MergeOpts, MergeResult, RunResult, WorktreeHandle, WorktreeManagerOptions, WorktreeStatus, } from './worktree-types.js';
|
|
3
2
|
export { assertSafePath, parseConflictPaths } from './worktree-git.js';
|
|
3
|
+
export type { AllocateOpts, MergeOpts, MergeResult, RunResult, WorktreeHandle, WorktreeManagerOptions, WorktreeStatus, } from './worktree-types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Owns the git-worktree lifecycle for isolated, parallel work units. Shells out
|
|
6
6
|
* to `git` directly (never via the `git` *tool*) so it can target arbitrary
|
|
@@ -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
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
|
|
@@ -64,8 +123,8 @@ fresh worker can execute. The same applies when verification refuses the same
|
|
|
64
123
|
work twice: stop retrying, and report `completion:"partial"` naming what was
|
|
65
124
|
refused and what the work still needs. A third identical attempt is never the
|
|
66
125
|
answer, and a refusal you cannot clear is a result to report, not a reason to
|
|
67
|
-
loop or to claim success. If an independent helper would materially improve
|
|
68
|
-
|
|
126
|
+
loop or to claim success. If an independent helper would materially improve the
|
|
127
|
+
outcome, ask the Director through the mailbox control-plane route with the
|
|
69
128
|
exact helper task, why it is independent, and the required output; continue
|
|
70
129
|
your own slice unless blocked.
|
|
71
130
|
|
|
@@ -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
|
|
|
@@ -9,7 +9,8 @@ that the coding agent can execute.
|
|
|
9
9
|
files, commands, constraints, or side effects the user did not request.
|
|
10
10
|
- Do not answer, solve, plan, or perform the request.
|
|
11
11
|
- Preserve concrete details verbatim: paths, identifiers, code, error text,
|
|
12
|
-
numbers, names, URLs, quoted strings,
|
|
12
|
+
numbers, names, URLs, quoted strings, explicit formatting requirements, and
|
|
13
|
+
control tags such as `[VIBE]`. Include each control tag in both output versions.
|
|
13
14
|
- Resolve references such as “it,” “these,” or “the other file” only when the
|
|
14
15
|
supplied context identifies them unambiguously. Otherwise preserve the
|
|
15
16
|
ambiguity rather than guessing.
|
|
@@ -1,8 +1,38 @@
|
|
|
1
1
|
## Common patterns
|
|
2
2
|
|
|
3
|
+
<!--ws:if tool=clarify-->
|
|
4
|
+
- **Autonomous default over interrupt:** adopt standard best practices and drive through next steps autonomously; reserve `clarify` only for irreversible or destructive forks
|
|
5
|
+
<!--ws:end-->
|
|
3
6
|
<!--ws:if tool=codebase-search tool=read tool=edit tool=grep-->
|
|
4
7
|
- **Inspect before edit:** live `codebase-search` -> `read` target -> `edit`; use `grep` for exact-text confirmation
|
|
5
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-->
|
|
12
|
+
<!--ws:if tool=codebase-skeleton tool=read-->
|
|
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
|
|
14
|
+
<!--ws:end-->
|
|
15
|
+
<!--ws:if tool=codebase-repo-map tool=codebase-skeleton-->
|
|
16
|
+
- **Map before navigate:** use `codebase-repo-map` at the start of complex tasks to orient across key project modules and architecture within a small token budget
|
|
17
|
+
<!--ws:end-->
|
|
18
|
+
<!--ws:if tool=codebase-skeleton tool=codebase-ast-replace-->
|
|
19
|
+
- **Outline then surgical mutate:** use `codebase-skeleton` to find symbols and line ranges, then `codebase-ast-replace` to update implementations without string-matching errors
|
|
20
|
+
<!--ws:end-->
|
|
21
|
+
<!--ws:if tool=codebase-impact-analysis tool=codebase-ast-replace-->
|
|
22
|
+
- **Blast radius before refactor:** use `codebase-impact-analysis` to map all call sites and test suites before modifying a signature, then update callers systematically
|
|
23
|
+
<!--ws:end-->
|
|
24
|
+
<!--ws:if tool=codebase-ast-replace tool=codebase-targeted-test-->
|
|
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
|
|
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-->
|
|
33
|
+
<!--ws:if tool=security-ast-scan-->
|
|
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
|
|
35
|
+
<!--ws:end-->
|
|
6
36
|
<!--ws:if tool=codebase-stats tool=codebase-index tool=codebase-search tool=edit-->
|
|
7
37
|
- **Search then operate:** live `codebase-stats` -> missing index? live `codebase-index` -> `codebase-search` -> identify targets -> iterative `edit`
|
|
8
38
|
<!--ws:end-->
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
## Delegation
|
|
2
2
|
|
|
3
|
-
Use `delegate` to hand work to a subagent (roles: {{roleList}}). Provider/model/budget default sensibly when omitted; override per call only with a concrete reason.
|
|
3
|
+
Use `delegate` to hand work to a subagent (roles: {{roleList}}). Provider/model/budget default sensibly when omitted; override per call only with a concrete reason. `delegate` blocks the leader for the full duration of the run.
|
|
4
|
+
|
|
5
|
+
For long-running work, use `spawn_subagent` + `assign_task` + `await_tasks` instead.
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
## Delegation
|
|
2
2
|
|
|
3
|
-
Use `delegate` to hand work to a subagent (roles: {{roleList}}). Good for:
|
|
3
|
+
Use `delegate` to hand work to a subagent (roles: {{roleList}}). Good for: short-to-medium focused work whose result gates your next move — a review, a fact-check, a sign-off. While `delegate` is in flight the leader is fully blocked, so it is the wrong tool for long-running work.
|
|
4
|
+
|
|
5
|
+
For fan-out or anything that may run long, use `spawn_subagent` + `assign_task` (+ `await_tasks`); the leader keeps doing other work while the worker churns.
|
|
4
6
|
|
|
5
7
|
Omit `provider`/`model` to use defaults. Set `timeoutMs`/`maxIterations`/`maxToolCalls` per task needs. Narrow scope: "audit these 3 files" beats "audit the codebase".
|
|
6
8
|
|
|
7
9
|
Check `stopReason` on result: `end_turn`=done, `budget_exhausted`=partial result, raise the matching limit.
|
|
10
|
+
|
|
11
|
+
A worker that realizes its task will run long should tell the leader ("my task is going to run long, please spawn a subagent instead") — preferably via `mail_send` so the leader can re-dispatch asynchronously.
|
|
@@ -107,12 +107,30 @@ Use `tree` only when directory structure matters.
|
|
|
107
107
|
<!--ws:if tool=codebase-stats-->
|
|
108
108
|
Use `codebase-stats` once before broad code discovery when available.
|
|
109
109
|
<!--ws:end-->
|
|
110
|
+
<!--ws:if tool=clarify-->
|
|
111
|
+
Use `clarify` only on irreversible forks; otherwise autonomously adopt industry best practices and keep moving.
|
|
112
|
+
<!--ws:end-->
|
|
110
113
|
<!--ws:if tool=codebase-search-->
|
|
111
|
-
|
|
114
|
+
Prefer `codebase-search` before `grep`, `glob`, or `tree` for symbols and concepts. Use `grep` only for exact text or regex.
|
|
115
|
+
<!--ws:end-->
|
|
116
|
+
<!--ws:if tool=codebase-skeleton-->
|
|
117
|
+
Use `codebase-skeleton` to inspect signatures, types, and module contracts without reading whole files.
|
|
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-->
|
|
122
|
+
<!--ws:if tool=codebase-repo-map-->
|
|
123
|
+
Use `codebase-repo-map` to generate a token-budgeted repository outline across key modules.
|
|
124
|
+
<!--ws:end-->
|
|
125
|
+
<!--ws:if tool=codebase-ast-replace-->
|
|
126
|
+
Use `codebase-ast-replace` to replace function/method bodies surgically via AST without context errors.
|
|
112
127
|
<!--ws:end-->
|
|
113
128
|
<!--ws:if tool=codebase-incoming-calls-->
|
|
114
129
|
Use `codebase-incoming-calls` to find all callers of a symbol before refactoring — not grep.
|
|
115
130
|
<!--ws:end-->
|
|
131
|
+
<!--ws:if tool=codebase-impact-analysis-->
|
|
132
|
+
Use `codebase-impact-analysis` to calculate blast radius and find all affected production call sites and test suites before editing.
|
|
133
|
+
<!--ws:end-->
|
|
116
134
|
<!--ws:if tool=codebase-outgoing-calls-->
|
|
117
135
|
Use `codebase-outgoing-calls` to see what a symbol calls/depends on.
|
|
118
136
|
<!--ws:end-->
|
|
@@ -121,9 +139,16 @@ Read source files returned by search before relying on them.
|
|
|
121
139
|
Use `codebase-index` only when the index is missing, stale, or explicitly needs refresh.
|
|
122
140
|
<!--ws:end-->
|
|
123
141
|
|
|
124
|
-
<!--ws:if tool=typecheck,test,lint,format,e2e_plan,language,language_info-->
|
|
142
|
+
<!--ws:if tool=typecheck,test,codebase-targeted-test,security-ast-scan,lint,format,e2e_plan,language,language_info-->
|
|
125
143
|
## Verification tools
|
|
126
144
|
|
|
145
|
+
<!--ws:if tool=security-ast-scan-->
|
|
146
|
+
Use `security-ast-scan` to catch N+1 loops, hardcoded secrets, and SQL vulnerabilities on newly written code.
|
|
147
|
+
<!--ws:end-->
|
|
148
|
+
<!--ws:if tool=codebase-targeted-test-->
|
|
149
|
+
Use `codebase-targeted-test` immediately after code changes to run only the affected test suites in milliseconds.
|
|
150
|
+
<!--ws:end-->
|
|
151
|
+
|
|
127
152
|
<!--ws:if tool=typecheck-->
|
|
128
153
|
Use `typecheck` before considering TypeScript work complete when it is available and relevant.
|
|
129
154
|
<!--ws:end-->
|
|
@@ -237,10 +262,13 @@ Use `fleet_status` to avoid duplicating active peer work when many agents are on
|
|
|
237
262
|
<!--ws:if tool=delegate,spawn_subagent-->
|
|
238
263
|
Use delegation only when it saves real time or adds independent review.
|
|
239
264
|
<!--ws:if tool=delegate-->
|
|
240
|
-
Use `delegate` for one blocking, self-contained task whose result you need next.
|
|
265
|
+
Use `delegate` for one blocking, self-contained, short task whose result you need next. `delegate` blocks the leader for the full duration of the run.
|
|
266
|
+
<!--ws:if tool=spawn_subagent-->
|
|
267
|
+
For long-running work, use `spawn_subagent` + `assign_task` + `await_tasks` instead.
|
|
268
|
+
<!--ws:end-->
|
|
241
269
|
<!--ws:end-->
|
|
242
270
|
<!--ws:if tool=spawn_subagent-->
|
|
243
|
-
Use `spawn_subagent`, `assign_task`, and `await_tasks` for parallel independent work.
|
|
271
|
+
Use `spawn_subagent`, `assign_task`, and `await_tasks` for parallel independent work, and for any work that may run long (minutes to hours) so the leader stays free.
|
|
244
272
|
<!--ws:end-->
|
|
245
273
|
Give subagents exact files, goals, constraints, and expected output.
|
|
246
274
|
<!--ws:end-->
|
|
@@ -260,16 +260,34 @@ 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,codebase-search,codebase-incoming-calls,codebase-outgoing-calls-->
|
|
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}}
|
|
265
|
+
{{tools:read,edit,write,patch,replace,glob,grep,tree,diff,json,logs,clarify,codebase-ast-replace,codebase-impact-analysis,codebase-invariant-check}}
|
|
266
|
+
<!--ws:if tool=clarify-->
|
|
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
|
+
<!--ws:end-->
|
|
266
269
|
<!--ws:if tool=codebase-search-->
|
|
267
|
-
- Prefer `codebase-search` before broad
|
|
270
|
+
- Prefer `codebase-search` before broad `grep`/`glob`/`tree` exploration for code understanding.
|
|
268
271
|
<!--ws:else-->
|
|
269
272
|
<!--ws:if tool=grep,glob-->
|
|
270
273
|
- Use the registered exact-text or path discovery tools above as appropriate.
|
|
271
274
|
<!--ws:end-->
|
|
272
275
|
<!--ws:end-->
|
|
276
|
+
<!--ws:if tool=codebase-skeleton-->
|
|
277
|
+
- `codebase-skeleton` to extract AST signatures and types with stripped bodies for fast module understanding (~70-90% token reduction).
|
|
278
|
+
<!--ws:end-->
|
|
279
|
+
<!--ws:if tool=codebase-repo-map-->
|
|
280
|
+
- `codebase-repo-map` to generate a token-budgeted, architecture-wide repository map with key exports and signatures.
|
|
281
|
+
<!--ws:end-->
|
|
282
|
+
<!--ws:if tool=codebase-ast-replace-->
|
|
283
|
+
- `codebase-ast-replace` for surgical AST-based replacement of functions, methods, or classes without string matching or whitespace errors.
|
|
284
|
+
<!--ws:end-->
|
|
285
|
+
<!--ws:if tool=codebase-impact-analysis-->
|
|
286
|
+
- `codebase-impact-analysis` to calculate blast radius and discover all affected call sites and test suites before modifying function signatures or types.
|
|
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-->
|
|
273
291
|
<!--ws:if tool=tree-->
|
|
274
292
|
- `tree` for directory layout.
|
|
275
293
|
<!--ws:end-->
|
|
@@ -287,10 +305,16 @@ Your capabilities arrive as tool groups, each with a distinct purpose. The group
|
|
|
287
305
|
<!--ws:end-->
|
|
288
306
|
<!--ws:end-->
|
|
289
307
|
|
|
290
|
-
<!--ws:if tool=lint,format,typecheck,test,e2e_plan,language,language_info,language_package-->
|
|
308
|
+
<!--ws:if tool=lint,format,typecheck,test,codebase-targeted-test,security-ast-scan,e2e_plan,language,language_info,language_package-->
|
|
291
309
|
### Code quality
|
|
292
|
-
{{tools:lint,format,typecheck,test,e2e_plan,language,language_info,language_package}}
|
|
310
|
+
{{tools:lint,format,typecheck,test,codebase-targeted-test,security-ast-scan,e2e_plan,language,language_info,language_package}}
|
|
293
311
|
- Run the narrowest appropriate verification from the tools above before calling changed code complete.
|
|
312
|
+
<!--ws:if tool=security-ast-scan-->
|
|
313
|
+
- `security-ast-scan` to detect contract-based security and performance flaws (N+1 database queries, SQL injection, hardcoded secrets, prototype pollution, ReDoS, unsafe eval) on new or edited code.
|
|
314
|
+
<!--ws:end-->
|
|
315
|
+
<!--ws:if tool=codebase-targeted-test-->
|
|
316
|
+
- `codebase-targeted-test` to automatically find and run only the test suites covering modified symbols/files in milliseconds.
|
|
317
|
+
<!--ws:end-->
|
|
294
318
|
<!--ws:if tool=test-->
|
|
295
319
|
- `test` with `files`/`grep` to scope to relevant tests.
|
|
296
320
|
<!--ws:end-->
|
|
@@ -352,10 +376,12 @@ Your capabilities arrive as tool groups, each with a distinct purpose. The group
|
|
|
352
376
|
|
|
353
377
|
**The blocking-vs-async distinction is the most important rule in this section:**
|
|
354
378
|
|
|
355
|
-
- `delegate` is **synchronous / blocking**: the leader's iteration pauses for the full duration of the subagent's run; no other tools execute while `delegate` is in flight. Use it only when your next decision genuinely needs the result (review, fact-check, sign-off). Multiple sequential `delegate` calls each block the leader, wasting wall-clock time.
|
|
379
|
+
- `delegate` is **synchronous / blocking**: the leader's iteration pauses for the full duration of the subagent's run; no other tools execute while `delegate` is in flight. Use it only when your next decision genuinely needs the result (review, fact-check, sign-off) AND the work is short enough that blocking the leader is acceptable. Multiple sequential `delegate` calls each block the leader, wasting wall-clock time.
|
|
356
380
|
- `spawn_subagent` + `assign_task` + `await_tasks` is the **async / non-blocking** pattern: `spawn_subagent` returns immediately with a `subagentId`, `assign_task` returns immediately with a `taskId`, the leader keeps doing other work, and `await_tasks` retrieves the result later. Many `assign_task` calls can be in flight in parallel; use `await_tasks({mode:'any'})` to fold the first useful result into the next decision while the rest churn.
|
|
357
381
|
|
|
358
|
-
**Decision rule:** does my next step depend on the result? If **yes** → `delegate`. If **no
|
|
382
|
+
**Decision rule:** does my next step depend on the result AND is the work short? If **yes** → `delegate`. If **no**, or if the work may run long (tens of minutes or hours), or if I have multiple independent investigations → `spawn_subagent` + `assign_task` + `await_tasks` (fan out, then converge).
|
|
383
|
+
|
|
384
|
+
A worker that realizes its task will run long should mail the leader (type `steer` or `ask` via `mail_send`) — e.g. *"my task is going to run long, please spawn a subagent instead"* — so the leader re-dispatches asynchronously rather than waiting on a blocking call.
|
|
359
385
|
|
|
360
386
|
<!--ws:else-->
|
|
361
387
|
- `delegate` runs a one-shot task in a separate context (own LLM, own budget) and **blocks** the leader for its full duration. Use it only when your next decision needs the result.
|
|
@@ -469,9 +495,9 @@ Your capabilities arrive as tool groups, each with a distinct purpose. The group
|
|
|
469
495
|
<!--ws:end-->
|
|
470
496
|
<!--ws:end-->
|
|
471
497
|
|
|
472
|
-
<!--ws:if tool=design,scaffold,codebase-index,codebase-search,codebase-incoming-calls,codebase-outgoing-calls,codebase-stats,e2e_plan-->
|
|
498
|
+
<!--ws:if tool=design,scaffold,codebase-index,codebase-search,codebase-skeleton,codebase-repo-map,codebase-incoming-calls,codebase-outgoing-calls,codebase-stats,e2e_plan-->
|
|
473
499
|
### Config & Project
|
|
474
|
-
{{tools:design,scaffold,codebase-index,codebase-search,codebase-incoming-calls,codebase-outgoing-calls,codebase-stats,e2e_plan}}
|
|
500
|
+
{{tools:design,scaffold,codebase-index,codebase-search,codebase-skeleton,codebase-repo-map,codebase-incoming-calls,codebase-outgoing-calls,codebase-stats,e2e_plan}}
|
|
475
501
|
<!--ws:if tool=design-->
|
|
476
502
|
- `design` to load/pin UI design kits and extract token palettes.
|
|
477
503
|
<!--ws:end-->
|
|
@@ -487,6 +513,12 @@ Your capabilities arrive as tool groups, each with a distinct purpose. The group
|
|
|
487
513
|
<!--ws:if tool=codebase-search-->
|
|
488
514
|
- `codebase-search` as the first search for indexed code symbols, concepts, definitions, and candidate modules.
|
|
489
515
|
<!--ws:end-->
|
|
516
|
+
<!--ws:if tool=codebase-skeleton-->
|
|
517
|
+
- `codebase-skeleton` to extract AST signatures and types with stripped bodies for efficient module understanding without burning context.
|
|
518
|
+
<!--ws:end-->
|
|
519
|
+
<!--ws:if tool=codebase-repo-map-->
|
|
520
|
+
- `codebase-repo-map` to generate a token-budgeted, architecture-wide repository map with key exports and signatures.
|
|
521
|
+
<!--ws:end-->
|
|
490
522
|
<!--ws:if tool=codebase-incoming-calls-->
|
|
491
523
|
- `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.
|
|
492
524
|
<!--ws:end-->
|
|
@@ -545,6 +577,12 @@ Before discovery on an unfamiliar area:
|
|
|
545
577
|
When the request requires understanding or locating code:
|
|
546
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`.
|
|
547
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-->
|
|
548
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.
|
|
549
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.
|
|
550
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.
|
|
@@ -568,12 +606,28 @@ recall → locate → assess impact → read → edit → read back → verify
|
|
|
568
606
|
<!--ws:else-->
|
|
569
607
|
3. **Assess impact** by grepping for every call site before changing a signature
|
|
570
608
|
<!--ws:end-->
|
|
609
|
+
<!--ws:if tool=codebase-impact-analysis-->
|
|
610
|
+
Before changing a signature or type, run `codebase-impact-analysis`.
|
|
611
|
+
<!--ws:end-->
|
|
571
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-->
|
|
572
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-->
|
|
573
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-->
|
|
574
627
|
<!--ws:if tool=lint,typecheck,test-->
|
|
575
628
|
7. **Verify** with {{tools:lint,typecheck,test}} as appropriate
|
|
576
629
|
<!--ws:end-->
|
|
630
|
+
<!--ws:end-->
|
|
577
631
|
<!--ws:if tool=remember-->
|
|
578
632
|
8. **Record** anything durable you learned (`remember`)
|
|
579
633
|
|