zelari-code 0.7.9 → 0.7.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +37 -37
- package/README.md +320 -295
- package/bin/zelari-code.js +62 -62
- package/dist/cli/app.js +33 -3
- package/dist/cli/app.js.map +1 -1
- package/dist/cli/components/LiveRegion.js +7 -3
- package/dist/cli/components/LiveRegion.js.map +1 -1
- package/dist/cli/components/SelectList.js +67 -0
- package/dist/cli/components/SelectList.js.map +1 -0
- package/dist/cli/components/Spinner.js +51 -0
- package/dist/cli/components/Spinner.js.map +1 -0
- package/dist/cli/components/SplashScreen.js +85 -85
- package/dist/cli/components/StatusBar.js +42 -34
- package/dist/cli/components/StatusBar.js.map +1 -1
- package/dist/cli/headless.js +10 -10
- package/dist/cli/hooks/useSlashDispatch.js +11 -1
- package/dist/cli/hooks/useSlashDispatch.js.map +1 -1
- package/dist/cli/keyStore.js +2 -2
- package/dist/cli/keyStore.js.map +1 -1
- package/dist/cli/main.bundled.js +15146 -14919
- package/dist/cli/main.bundled.js.map +4 -4
- package/dist/cli/main.js +1 -1
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/modelDiscovery.js +42 -5
- package/dist/cli/modelDiscovery.js.map +1 -1
- package/dist/cli/provider/openai-compatible.js +4 -2
- package/dist/cli/provider/openai-compatible.js.map +1 -1
- package/dist/cli/slashCommands.js +22 -5
- package/dist/cli/slashCommands.js.map +1 -1
- package/dist/cli/slashHandlers/provider.js +102 -5
- package/dist/cli/slashHandlers/provider.js.map +1 -1
- package/package.json +2 -2
- package/dist/agents/advancedTools.js +0 -115
- package/dist/agents/advancedTools.js.map +0 -1
- package/dist/agents/councilApi.js +0 -375
- package/dist/agents/councilApi.js.map +0 -1
- package/dist/agents/councilDirectives.js +0 -100
- package/dist/agents/councilDirectives.js.map +0 -1
- package/dist/agents/promoteMember.js +0 -210
- package/dist/agents/promoteMember.js.map +0 -1
- package/dist/agents/promptModules.js +0 -139
- package/dist/agents/promptModules.js.map +0 -1
- package/dist/agents/roles.js +0 -299
- package/dist/agents/roles.js.map +0 -1
- package/dist/agents/skills/builtin/debugging.js +0 -248
- package/dist/agents/skills/builtin/debugging.js.map +0 -1
- package/dist/agents/skills/builtin/docs.js +0 -301
- package/dist/agents/skills/builtin/docs.js.map +0 -1
- package/dist/agents/skills/builtin/git-ops.js +0 -301
- package/dist/agents/skills/builtin/git-ops.js.map +0 -1
- package/dist/agents/skills/builtin/planning.js +0 -335
- package/dist/agents/skills/builtin/planning.js.map +0 -1
- package/dist/agents/skills/builtin/refactoring.js +0 -261
- package/dist/agents/skills/builtin/refactoring.js.map +0 -1
- package/dist/agents/skills/builtin/review.js +0 -302
- package/dist/agents/skills/builtin/review.js.map +0 -1
- package/dist/agents/skills/builtin/testing.js +0 -245
- package/dist/agents/skills/builtin/testing.js.map +0 -1
- package/dist/agents/skills.js +0 -272
- package/dist/agents/skills.js.map +0 -1
- package/dist/agents/systemPromptBuilder.js +0 -151
- package/dist/agents/systemPromptBuilder.js.map +0 -1
- package/dist/agents/toolSchemas.js +0 -249
- package/dist/agents/toolSchemas.js.map +0 -1
- package/dist/agents/tools.js +0 -196
- package/dist/agents/tools.js.map +0 -1
- package/dist/agents/vaultTools.js +0 -134
- package/dist/agents/vaultTools.js.map +0 -1
- package/dist/cli/components/CollapsibleToolOutput.js +0 -43
- package/dist/cli/components/CollapsibleToolOutput.js.map +0 -1
- package/dist/cli/components/Header.js +0 -38
- package/dist/cli/components/Header.js.map +0 -1
- package/dist/main/core/AgentHarness.js +0 -467
- package/dist/main/core/AgentHarness.js.map +0 -1
- package/dist/main/core/providerStream.js +0 -99
- package/dist/main/core/providerStream.js.map +0 -1
- package/dist/main/core/sessionJsonl.js +0 -99
- package/dist/main/core/sessionJsonl.js.map +0 -1
- package/dist/main/core/tools/auditLog.js +0 -26
- package/dist/main/core/tools/auditLog.js.map +0 -1
- package/dist/main/core/tools/builtin/filesystem.js +0 -110
- package/dist/main/core/tools/builtin/filesystem.js.map +0 -1
- package/dist/main/core/tools/builtin/listFiles.js +0 -86
- package/dist/main/core/tools/builtin/listFiles.js.map +0 -1
- package/dist/main/core/tools/builtin/search.js +0 -56
- package/dist/main/core/tools/builtin/search.js.map +0 -1
- package/dist/main/core/tools/builtin/shell.js +0 -51
- package/dist/main/core/tools/builtin/shell.js.map +0 -1
- package/dist/main/core/tools/registry.js +0 -71
- package/dist/main/core/tools/registry.js.map +0 -1
- package/dist/main/core/tools/toolTypes.js +0 -8
- package/dist/main/core/tools/toolTypes.js.map +0 -1
- package/dist/main/core/tools/zodBridge.js +0 -56
- package/dist/main/core/tools/zodBridge.js.map +0 -1
- package/dist/shared/eventBus.js +0 -104
- package/dist/shared/eventBus.js.map +0 -1
- package/dist/shared/events.js +0 -73
- package/dist/shared/events.js.map +0 -1
- package/dist/shared/index.js +0 -8
- package/dist/shared/index.js.map +0 -1
- package/dist/types/context.js +0 -3
- package/dist/types/context.js.map +0 -1
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/types/knowledge.js +0 -2
- package/dist/types/knowledge.js.map +0 -1
- package/dist/types/systemTypes.js +0 -10
- package/dist/types/systemTypes.js.map +0 -1
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import { registerCodingSkill } from '../../skills.js';
|
|
2
|
-
const CLARIFICATION_PROTOCOL = `
|
|
3
|
-
|
|
4
|
-
WHEN TO ASK THE USER (clarification):
|
|
5
|
-
If a single missing fact would materially change your output (target platform, scope, a binary design choice with significant trade-offs, a constraint you cannot safely assume), pause and ask the user by appending EXACTLY this block at the end of your message:
|
|
6
|
-
|
|
7
|
-
---QUESTION---
|
|
8
|
-
{ "question": "One focused question", "choices": ["Option A", "Option B", "Option C"], "context": "Why this matters" }
|
|
9
|
-
---END---
|
|
10
|
-
|
|
11
|
-
Rules for clarifications:
|
|
12
|
-
- Ask AT MOST ONE question per turn, and only when genuinely blocked.
|
|
13
|
-
- Prefer a small set of concrete "choices" (2-4). The user can still type a custom answer.
|
|
14
|
-
- Do NOT ask for information that could be reasonably assumed or already in shared context.
|
|
15
|
-
- If you can proceed with a sound documented assumption, DO SO instead of asking.`;
|
|
16
|
-
const commitMessage = {
|
|
17
|
-
id: 'commit-message',
|
|
18
|
-
version: '1.0.0',
|
|
19
|
-
name: 'Commit Message',
|
|
20
|
-
description: 'Generate a Conventional Commits message from a staged git diff. Format: <type>(<scope>): <subject>. Body explains WHY. Footer references issues.',
|
|
21
|
-
category: 'ops',
|
|
22
|
-
requiredRoles: ['atlas'],
|
|
23
|
-
requiredTools: [],
|
|
24
|
-
estimatedCost: 'low',
|
|
25
|
-
enabledByDefault: true,
|
|
26
|
-
builtin: true,
|
|
27
|
-
triggers: [
|
|
28
|
-
'A developer has staged changes and needs a commit message',
|
|
29
|
-
'A PR description requires a list of conventional commits',
|
|
30
|
-
'A CHANGELOG is generated from commit history',
|
|
31
|
-
],
|
|
32
|
-
antiPatterns: [
|
|
33
|
-
'Empty diff (nothing staged) — fail fast',
|
|
34
|
-
'Merge commits or reverts — different format',
|
|
35
|
-
'Multi-purpose commits (refactor + feat + fix in one) — split first',
|
|
36
|
-
],
|
|
37
|
-
requires: [],
|
|
38
|
-
relatedSkills: ['pr-description', 'write-changelog'],
|
|
39
|
-
tags: ['git', 'commit', 'conventional-commits', 'changelog'],
|
|
40
|
-
examples: [
|
|
41
|
-
{
|
|
42
|
-
input: 'Staged diff: 3 files changed, +45/-12. Adds brain event types and EventBus class.',
|
|
43
|
-
output: {
|
|
44
|
-
subject: 'feat(events): add BrainEvent types + EventBus (Phase 11)',
|
|
45
|
-
body: `Adds the provider-neutral event layer:
|
|
46
|
-
- 12 BrainEvent discriminated union types
|
|
47
|
-
- EventBus class with typed subscribers + error isolation
|
|
48
|
-
- emit/subscribe/subscribeAll API
|
|
49
|
-
|
|
50
|
-
Foundation for Phase 12 (AgentHarness extraction).`,
|
|
51
|
-
footer: 'Refs: docs/plans/2026-06-28-zelari-code.md',
|
|
52
|
-
type: 'feat',
|
|
53
|
-
scope: 'events',
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
],
|
|
57
|
-
outputSchema: '{ subject: string; body: string; footer: string; type: "feat" | "fix" | "refactor" | "docs" | "test" | "chore" | "perf" | "style"; scope: string }',
|
|
58
|
-
systemPromptFragment: `You are writing a Conventional Commits message.
|
|
59
|
-
|
|
60
|
-
## Format
|
|
61
|
-
<type>(<scope>): <subject>
|
|
62
|
-
|
|
63
|
-
<body — explain WHY, not WHAT>
|
|
64
|
-
|
|
65
|
-
<footer — issue refs, breaking changes>
|
|
66
|
-
|
|
67
|
-
## Types
|
|
68
|
-
- feat: new feature
|
|
69
|
-
- fix: bug fix
|
|
70
|
-
- refactor: code change that neither fixes a bug nor adds a feature
|
|
71
|
-
- docs: documentation only
|
|
72
|
-
- test: adding/correcting tests
|
|
73
|
-
- chore: build/tooling changes (deps, CI, config)
|
|
74
|
-
- perf: performance improvement
|
|
75
|
-
- style: formatting, missing semicolons, etc. (no logic change)
|
|
76
|
-
|
|
77
|
-
## Subject rules
|
|
78
|
-
- Imperative mood ("add" not "added")
|
|
79
|
-
- Lowercase (except proper nouns)
|
|
80
|
-
- Max 72 characters
|
|
81
|
-
- No trailing period
|
|
82
|
-
|
|
83
|
-
## Body rules
|
|
84
|
-
- Wrap at 72 characters
|
|
85
|
-
- Explain WHY the change was made
|
|
86
|
-
- Bullet points for multiple distinct changes
|
|
87
|
-
|
|
88
|
-
## Footer rules
|
|
89
|
-
- \`Refs: #123\` for related issues
|
|
90
|
-
- \`BREAKING CHANGE: <description>\` for breaking changes
|
|
91
|
-
- \`Co-authored-by: Name <email>\` for pair work
|
|
92
|
-
|
|
93
|
-
## Output format (JSON-typed)
|
|
94
|
-
- subject: string
|
|
95
|
-
- body: string
|
|
96
|
-
- footer: string
|
|
97
|
-
- type: ConventionalCommitType
|
|
98
|
-
- scope: string (optional, lowercase module name)
|
|
99
|
-
|
|
100
|
-
Stay under 300 words.${CLARIFICATION_PROTOCOL}`,
|
|
101
|
-
};
|
|
102
|
-
const prDescription = {
|
|
103
|
-
id: 'pr-description',
|
|
104
|
-
version: '1.0.0',
|
|
105
|
-
name: 'PR Description',
|
|
106
|
-
description: 'Generate a pull request description with sections: Summary, Motivation, Changes, Testing, Screenshots, Risks. Synthesizes from commits + diff + related issues.',
|
|
107
|
-
category: 'ops',
|
|
108
|
-
requiredRoles: ['prometheus', 'atlas'],
|
|
109
|
-
requiredTools: [],
|
|
110
|
-
estimatedCost: 'medium',
|
|
111
|
-
enabledByDefault: true,
|
|
112
|
-
builtin: true,
|
|
113
|
-
triggers: [
|
|
114
|
-
'A PR is ready for review and needs a description',
|
|
115
|
-
'A PR template requires filling in structured sections',
|
|
116
|
-
'A large change (>200 LOC) needs careful framing for reviewers',
|
|
117
|
-
],
|
|
118
|
-
antiPatterns: [
|
|
119
|
-
'A 1-line typo fix — title only, no body needed',
|
|
120
|
-
'A WIP / draft PR — defer until ready',
|
|
121
|
-
'Generated code (codegen output) — link to the generator instead',
|
|
122
|
-
],
|
|
123
|
-
requires: ['commit-message'],
|
|
124
|
-
relatedSkills: ['commit-message', 'write-changelog'],
|
|
125
|
-
tags: ['git', 'pr', 'pull-request', 'review', 'documentation'],
|
|
126
|
-
examples: [
|
|
127
|
-
{
|
|
128
|
-
input: 'PR for Phase 11 of AnathemaCoder: BrainEvent types + EventBus + LLM streaming wiring',
|
|
129
|
-
output: {
|
|
130
|
-
title: 'Phase 11: Provider-neutral events foundation',
|
|
131
|
-
summary: 'Introduces the BrainEvent discriminated union and EventBus — the provider-neutral contract between LLM providers and any frontend (Electron renderer today, Ink CLI in Phase 14).',
|
|
132
|
-
motivation: 'The current IPC bridge (\`emitChunk\`/\`emitDone\`) couples every frontend to provider-specific chunks. Any new frontend (CLI, mobile, web) would need to duplicate SSE parsing per provider. This is the foundation that lets Phase 12 extract an AgentHarness usable from any context.',
|
|
133
|
-
changes: [
|
|
134
|
-
'Added \`electron/shared/events.ts\` — 12 discriminated union types (agent_start, message_delta, tool_execution_start, etc.)',
|
|
135
|
-
'Added \`electron/shared/eventBus.ts\` — typed pub/sub with error isolation',
|
|
136
|
-
'Wired 5 local emit helpers in \`electron/main/ipc/llm.ts\` (emitAgentStart, emitMessageStart, emitMessageDelta, emitMessageEnd, emitBrainError)',
|
|
137
|
-
'Tool execution emits \`BrainToolExecutionStartEvent\` when provider yields tool_call',
|
|
138
|
-
'Council emits \`agent_start\` / \`agent_end\` at run boundaries',
|
|
139
|
-
'6 new vitest tests for EventBus (typed delivery, wildcard, error isolation)',
|
|
140
|
-
],
|
|
141
|
-
testing: '96/96 tests passing. New: 6 EventBus tests in tests/unit/eventBus.test.ts. Manual: existing Electron renderer unchanged (verified Council chat still streams correctly).',
|
|
142
|
-
risks: [
|
|
143
|
-
'Adding event emission alongside IPC is purely additive — no migration needed for existing renderer code.',
|
|
144
|
-
'Council event timing verified manually: agent_start fires before any message events, agent_end fires after.',
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
outputSchema: '{ title: string; summary: string; motivation: string; changes: string[]; testing: string; risks: string[] }',
|
|
150
|
-
systemPromptFragment: `You are writing a Pull Request description.
|
|
151
|
-
|
|
152
|
-
## Sections (use all)
|
|
153
|
-
1. **Title** (max 72 chars, imperative mood)
|
|
154
|
-
2. **Summary** (1 paragraph): what does this PR do?
|
|
155
|
-
3. **Motivation** (1-2 paragraphs): WHY? What problem does it solve?
|
|
156
|
-
4. **Changes** (bullet list, 5-15 items): specific files/concepts changed
|
|
157
|
-
5. **Testing** (1 paragraph): how was it verified? Test counts, manual steps
|
|
158
|
-
6. **Risks** (bullet list, 2-5 items): what could go wrong? Migration needed?
|
|
159
|
-
|
|
160
|
-
## Output format (JSON-typed)
|
|
161
|
-
- title: string
|
|
162
|
-
- summary: string
|
|
163
|
-
- motivation: string
|
|
164
|
-
- changes: string[]
|
|
165
|
-
- testing: string
|
|
166
|
-
- risks: string[]
|
|
167
|
-
|
|
168
|
-
## PR description principles
|
|
169
|
-
- **Reviewer-first**: optimize for someone who has NEVER seen this code
|
|
170
|
-
- **Concrete not abstract**: cite file paths, line numbers, function names
|
|
171
|
-
- **Risk-honest**: don't hide breaking changes or migration steps
|
|
172
|
-
- **Self-contained**: PR description should make sense without clicking through to issues
|
|
173
|
-
|
|
174
|
-
Stay under 500 words.${CLARIFICATION_PROTOCOL}`,
|
|
175
|
-
};
|
|
176
|
-
const ciPipeline = {
|
|
177
|
-
id: 'ci-pipeline',
|
|
178
|
-
version: '1.0.0',
|
|
179
|
-
name: 'CI Pipeline',
|
|
180
|
-
description: 'Generate a GitHub Actions workflow YAML that runs typecheck + lint + test + build on every push and PR. Configures Node version, caching, and failure annotations.',
|
|
181
|
-
category: 'ops',
|
|
182
|
-
requiredRoles: ['atlas'],
|
|
183
|
-
requiredTools: [],
|
|
184
|
-
estimatedCost: 'medium',
|
|
185
|
-
enabledByDefault: true,
|
|
186
|
-
builtin: true,
|
|
187
|
-
triggers: [
|
|
188
|
-
'A project is being open-sourced and needs CI',
|
|
189
|
-
'Existing CI is missing a step (e.g. no typecheck)',
|
|
190
|
-
'A new test framework is added',
|
|
191
|
-
'A release pipeline is being automated',
|
|
192
|
-
],
|
|
193
|
-
antiPatterns: [
|
|
194
|
-
'The project has no tests yet — write tests first, then CI',
|
|
195
|
-
'A different CI system is in use (CircleCI, GitLab CI) — use that one',
|
|
196
|
-
'The project is a personal/internal tool (CI rarely matters)',
|
|
197
|
-
],
|
|
198
|
-
requires: [],
|
|
199
|
-
relatedSkills: ['write-changelog'],
|
|
200
|
-
tags: ['ci', 'github-actions', 'automation', 'pipeline'],
|
|
201
|
-
examples: [
|
|
202
|
-
{
|
|
203
|
-
input: 'Generate GitHub Actions for AnathemaBrain (Electron + React + TS + Vitest)',
|
|
204
|
-
output: {
|
|
205
|
-
workflowFile: '.github/workflows/ci.yml',
|
|
206
|
-
content: `name: CI
|
|
207
|
-
|
|
208
|
-
on:
|
|
209
|
-
push:
|
|
210
|
-
branches: [main]
|
|
211
|
-
pull_request:
|
|
212
|
-
branches: [main]
|
|
213
|
-
|
|
214
|
-
jobs:
|
|
215
|
-
test:
|
|
216
|
-
runs-on: ubuntu-latest
|
|
217
|
-
timeout-minutes: 15
|
|
218
|
-
strategy:
|
|
219
|
-
matrix:
|
|
220
|
-
node-version: [20.x]
|
|
221
|
-
|
|
222
|
-
steps:
|
|
223
|
-
- uses: actions/checkout@v4
|
|
224
|
-
|
|
225
|
-
- name: Setup Node.js \${{ matrix.node-version }}
|
|
226
|
-
uses: actions/setup-node@v4
|
|
227
|
-
with:
|
|
228
|
-
node-version: \${{ matrix.node-version }}
|
|
229
|
-
cache: 'npm'
|
|
230
|
-
|
|
231
|
-
- name: Install dependencies
|
|
232
|
-
run: npm ci
|
|
233
|
-
|
|
234
|
-
- name: Typecheck (node config)
|
|
235
|
-
run: npm run typecheck:node
|
|
236
|
-
|
|
237
|
-
- name: Typecheck (web config)
|
|
238
|
-
run: npm run typecheck:web
|
|
239
|
-
|
|
240
|
-
- name: Lint
|
|
241
|
-
run: npm run lint
|
|
242
|
-
|
|
243
|
-
- name: Test
|
|
244
|
-
run: npm run test
|
|
245
|
-
|
|
246
|
-
- name: Build (Electron renderer + main)
|
|
247
|
-
run: npm run build
|
|
248
|
-
|
|
249
|
-
- name: Upload coverage
|
|
250
|
-
if: success()
|
|
251
|
-
uses: actions/upload-artifact@v4
|
|
252
|
-
with:
|
|
253
|
-
name: coverage-\${{ matrix.node-version }}
|
|
254
|
-
path: coverage/
|
|
255
|
-
`,
|
|
256
|
-
jobs: ['test'],
|
|
257
|
-
triggers: ['push to main', 'pull_request to main'],
|
|
258
|
-
nodeVersion: '20.x',
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
],
|
|
262
|
-
outputSchema: '{ workflowFile: string; content: string; jobs: string[]; triggers: string[]; nodeVersion: string }',
|
|
263
|
-
systemPromptFragment: `You are writing a GitHub Actions workflow YAML.
|
|
264
|
-
|
|
265
|
-
## Required structure
|
|
266
|
-
1. **name**: workflow display name
|
|
267
|
-
2. **on**: triggers (push to main, pull_request, manual workflow_dispatch)
|
|
268
|
-
3. **jobs**: at least one job with steps
|
|
269
|
-
4. **runs-on**: ubuntu-latest (default)
|
|
270
|
-
5. **timeout-minutes**: 15 (default, increase for slower builds)
|
|
271
|
-
6. **matrix.node-version**: pin to a specific major version (e.g. 20.x)
|
|
272
|
-
|
|
273
|
-
## Standard steps (in order)
|
|
274
|
-
1. actions/checkout@v4
|
|
275
|
-
2. actions/setup-node@v4 with cache: 'npm'
|
|
276
|
-
3. npm ci (NOT npm install — faster in CI)
|
|
277
|
-
4. typecheck (run the project's typecheck script)
|
|
278
|
-
5. lint (run the project's lint script)
|
|
279
|
-
6. test (run the project's test script)
|
|
280
|
-
7. build (run the project's build script, if applicable)
|
|
281
|
-
|
|
282
|
-
## Output format (JSON-typed)
|
|
283
|
-
- workflowFile: string (path like .github/workflows/ci.yml)
|
|
284
|
-
- content: string (the full YAML)
|
|
285
|
-
- jobs: string[] (job names)
|
|
286
|
-
- triggers: string[] (trigger events)
|
|
287
|
-
- nodeVersion: string (pinned Node version)
|
|
288
|
-
|
|
289
|
-
## CI principles
|
|
290
|
-
- **Fail fast**: order steps from fastest → slowest (typecheck before build)
|
|
291
|
-
- **Cache dependencies**: cache: 'npm' saves 30s+ on cold builds
|
|
292
|
-
- **Pin versions**: use @v4 not @latest for reproducibility
|
|
293
|
-
- **Don't cache build artifacts**: cache only deps
|
|
294
|
-
- **Separate jobs for parallel**: typecheck, lint, test can be parallel jobs
|
|
295
|
-
|
|
296
|
-
Stay under 500 words.${CLARIFICATION_PROTOCOL}`,
|
|
297
|
-
};
|
|
298
|
-
registerCodingSkill(commitMessage);
|
|
299
|
-
registerCodingSkill(prDescription);
|
|
300
|
-
registerCodingSkill(ciPipeline);
|
|
301
|
-
//# sourceMappingURL=git-ops.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-ops.js","sourceR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ACtB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE;QACR,8CAA8C;QAC9C,mDAAmD;QACnD,+BAA+B;QAC/B,uCAAuC;KACxC;IACD,YAAY,EAAE;QACZ,2DAA2D;QAC3D,sEAAsE;QACtE,6DAA6D;KAC9D;IACD,QAAQ,EAAE,EAAE;IACZ,aAAa,EAAE,CAAC,iBAAiB,CAAC;IAClC,IAAI,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,CAAC;IACxD,QAAQ,EAAE;QACR;YACE,KAAK,EAAE,4EAA4E;YACnF,MAAM,EAAE;gBACN,YAAY,EAAE,0BAA0B;gBACxC,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDhB;gBACO,IAAI,EAAE,CAAC,MAAM,CAAC;gBACd,QAAQ,EAAE,CAAC,cAAc,EAAE,sBAAsB,CAAC;gBAClD,WAAW,EAAE,MAAM;aACpB;SACF;KACF;IACD,YAAY,EAAE,oGAAoG;IAClH,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAiCD,sBAAsB,EAAE;CAC9C,CAAC;AAEF,mBAAmB,CAAC,aAAa,CAAC,CAAC;AACnC,mBAAmB,CAAC,aAAa,CAAC,CAAC;AACnC,mBAAmB,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import { registerCodingSkill } from '../../skills.js';
|
|
2
|
-
const CLARIFICATION_PROTOCOL = `
|
|
3
|
-
|
|
4
|
-
WHEN TO ASK THE USER (clarification):
|
|
5
|
-
If a single missing fact would materially change your output (target platform, scope, a binary design choice with significant trade-offs, a constraint you cannot safely assume), pause and ask the user by appending EXACTLY this block at the end of your message:
|
|
6
|
-
|
|
7
|
-
---QUESTION---
|
|
8
|
-
{ "question": "One focused question", "choices": ["Option A", "Option B", "Option C"], "context": "Why this matters" }
|
|
9
|
-
---END---
|
|
10
|
-
|
|
11
|
-
Rules for clarifications:
|
|
12
|
-
- Ask AT MOST ONE question per turn, and only when genuinely blocked.
|
|
13
|
-
- Prefer a small set of concrete "choices" (2-4). The user can still type a custom answer.
|
|
14
|
-
- Do NOT ask for information that could be reasonably assumed or already in shared context.
|
|
15
|
-
- If you can proceed with a sound documented assumption, DO SO instead of asking.`;
|
|
16
|
-
const architectFeature = {
|
|
17
|
-
id: 'architect-feature',
|
|
18
|
-
version: '1.0.0',
|
|
19
|
-
name: 'Architect Feature',
|
|
20
|
-
description: 'Multi-perspective feature design: explore 3-5 alternatives, pick the strongest, generate an ADR, list concrete risks and mitigations.',
|
|
21
|
-
category: 'planning',
|
|
22
|
-
requiredRoles: ['sisyphus', 'prometheus', 'oracle'],
|
|
23
|
-
requiredTools: ['createTask', 'searchRAG'],
|
|
24
|
-
estimatedCost: 'high',
|
|
25
|
-
enabledByDefault: true,
|
|
26
|
-
builtin: true,
|
|
27
|
-
triggers: [
|
|
28
|
-
'New feature spanning multiple modules',
|
|
29
|
-
'Architectural decision with long-term impact',
|
|
30
|
-
'Public API design (libraries, services, CLI commands)',
|
|
31
|
-
'Schema or data model changes affecting persistence',
|
|
32
|
-
'Cross-cutting concern (auth, logging, caching) added to existing system',
|
|
33
|
-
],
|
|
34
|
-
antiPatterns: [
|
|
35
|
-
'Simple bug fix — use debug-with-rag instead',
|
|
36
|
-
'Single-file refactor under 500 LOC — use refactor-monolith only if > 1000 LOC',
|
|
37
|
-
'Documentation update — use write-tsdoc or write-readme',
|
|
38
|
-
'Adding a one-line config or env var — direct edit is faster',
|
|
39
|
-
'Pure refactor with no design choice — use refactor-monolith or extract-reusable',
|
|
40
|
-
],
|
|
41
|
-
requires: ['architect-decision-record'],
|
|
42
|
-
relatedSkills: ['scope-check', 'migrate-stack', 'code-review'],
|
|
43
|
-
tags: ['planning', 'architecture', 'design', 'multi-role', 'adr'],
|
|
44
|
-
examples: [
|
|
45
|
-
{
|
|
46
|
-
input: 'Add OAuth login via Google to the Electron desktop app',
|
|
47
|
-
output: {
|
|
48
|
-
goal: 'Enable users to sign in to AnathemaBrain with their Google account, replacing the current email+password flow.',
|
|
49
|
-
alternatives: [
|
|
50
|
-
{ approach: 'OAuth library (Passport.js)', score: 'F:4 R:3 M:5', rationale: 'Battle-tested, large ecosystem, easy revocation, ~50KB bundle.' },
|
|
51
|
-
{ approach: 'Custom PKCE flow with raw HTTP', score: 'F:3 R:4 M:2', rationale: 'No deps, but high surface area (token refresh, CSRF, error states).' },
|
|
52
|
-
{ approach: 'Use Electron built-in OAuth via deep link', score: 'F:4 R:2 M:4', rationale: 'Native to Electron, no redirect_uri issues, but desktop-specific.' },
|
|
53
|
-
],
|
|
54
|
-
chosen: { approach: 'Passport.js with Google strategy', rationale: 'Lowest maintenance burden given the OAuth library ecosystem; revocation handled by the library.' },
|
|
55
|
-
adrPath: 'docs/adr/0014-google-oauth.md',
|
|
56
|
-
risks: [
|
|
57
|
-
{ risk: 'Token refresh edge cases when offline', mitigation: 'Persist refresh token in keychain (already implemented for Grok OAuth).' },
|
|
58
|
-
{ risk: 'CSRF on deep-link redirect', mitigation: 'Use OAuth state parameter with cryptographic random nonce.' },
|
|
59
|
-
],
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
input: 'Add a /skill command to the CLI that expands a skill template',
|
|
64
|
-
output: {
|
|
65
|
-
goal: 'Allow the CLI to invoke a skill by name, expanding the template and dispatching to the council.',
|
|
66
|
-
alternatives: [
|
|
67
|
-
{ approach: 'Slash command handler in cli/main.ts', score: 'F:5 R:1 M:5', rationale: 'Direct, simple.' },
|
|
68
|
-
{ approach: 'Plugin system with skill loader', score: 'F:2 R:4 M:2', rationale: 'Over-engineered for v1.' },
|
|
69
|
-
],
|
|
70
|
-
chosen: { approach: 'Slash command handler', rationale: 'YAGNI — defer plugin system to v2 when users request it.' },
|
|
71
|
-
adrPath: 'docs/adr/0015-cli-skill-commands.md',
|
|
72
|
-
risks: [
|
|
73
|
-
{ risk: 'Skill name collisions across categories', mitigation: 'Namespace as `<category>:<name>` (e.g. `planning:architect-feature`).' },
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
outputSchema: '{ goal: string; alternatives: Array<{ approach: string; score: string; rationale: string }>; chosen: { approach: string; rationale: string }; adrPath: string; risks: Array<{ risk: string; mitigation: string }> }',
|
|
79
|
-
systemPromptFragment: `You are designing a feature with multi-perspective analysis.
|
|
80
|
-
|
|
81
|
-
## Methodology
|
|
82
|
-
1. Restate the goal in ONE sentence: what user need does this serve?
|
|
83
|
-
2. Search the knowledge base for prior decisions: searchRAG(query="<feature-keyword>")
|
|
84
|
-
3. Generate 3-5 DISTINCT approaches (vary the axis: library vs custom, sync vs async, desktop vs server, etc.).
|
|
85
|
-
4. Score each approach on three dimensions (1-5 each):
|
|
86
|
-
- Feasibility (F): how easy to implement given the current stack
|
|
87
|
-
- Risk (R, INVERTED — lower is better): likelihood of bugs, security holes, scope creep
|
|
88
|
-
- Maintenance (M): long-term cost (bus factor, doc quality, ecosystem health)
|
|
89
|
-
5. Pick the top approach and justify in 1-2 sentences.
|
|
90
|
-
6. Generate an ADR (link to architect-decision-record skill).
|
|
91
|
-
7. List 2-5 concrete risks + mitigations.
|
|
92
|
-
|
|
93
|
-
## Output format (JSON-typed)
|
|
94
|
-
- goal: string
|
|
95
|
-
- alternatives: Array<{ approach: string; score: string; rationale: string }>
|
|
96
|
-
- chosen: { approach: string; rationale: string }
|
|
97
|
-
- adrPath: string
|
|
98
|
-
- risks: Array<{ risk: string; mitigation: string }>
|
|
99
|
-
|
|
100
|
-
Stay under 400 words. Be decisive: pick ONE approach, do not list 3 equally good options.${CLARIFICATION_PROTOCOL}`,
|
|
101
|
-
};
|
|
102
|
-
const architectDecisionRecord = {
|
|
103
|
-
id: 'architect-decision-record',
|
|
104
|
-
version: '1.0.0',
|
|
105
|
-
name: 'Architect Decision Record',
|
|
106
|
-
description: 'Generate an ADR (Architecture Decision Record) from a decision rationale. Format: Context, Decision, Consequences, Alternatives Considered.',
|
|
107
|
-
category: 'planning',
|
|
108
|
-
requiredRoles: ['prometheus', 'atlas'],
|
|
109
|
-
requiredTools: ['createDocument'],
|
|
110
|
-
estimatedCost: 'low',
|
|
111
|
-
enabledByDefault: true,
|
|
112
|
-
builtin: true,
|
|
113
|
-
triggers: [
|
|
114
|
-
'A non-trivial architectural decision has been made',
|
|
115
|
-
'Reviewing a past decision and want to capture WHY it was made',
|
|
116
|
-
'Onboarding a new team member to the rationale behind existing choices',
|
|
117
|
-
'After running architect-feature, to formalize the chosen approach',
|
|
118
|
-
],
|
|
119
|
-
antiPatterns: [
|
|
120
|
-
'No real decision has been made yet — first run architect-feature or scope-check',
|
|
121
|
-
'Trivial choice (file naming, color scheme) — use a code comment',
|
|
122
|
-
'Decision is reversible in under 1 hour — defer the ADR',
|
|
123
|
-
],
|
|
124
|
-
requires: [],
|
|
125
|
-
relatedSkills: ['architect-feature', 'scope-check'],
|
|
126
|
-
tags: ['planning', 'documentation', 'adr', 'decision-log'],
|
|
127
|
-
examples: [
|
|
128
|
-
{
|
|
129
|
-
input: 'Document why we use SQLite over Postgres for local storage',
|
|
130
|
-
output: {
|
|
131
|
-
path: 'docs/adr/0007-sqlite-over-postgres.md',
|
|
132
|
-
content: `# 7. SQLite over Postgres for local storage
|
|
133
|
-
|
|
134
|
-
## Context
|
|
135
|
-
AnathemaBrain is an Electron desktop app that runs entirely on the user's machine. We need persistent storage for vault documents, RAG vectors, settings, and council sessions.
|
|
136
|
-
|
|
137
|
-
## Decision
|
|
138
|
-
Use SQLite (via better-sqlite3) for all local storage.
|
|
139
|
-
|
|
140
|
-
## Consequences
|
|
141
|
-
- Zero-config: works out of the box, no separate DB server to manage
|
|
142
|
-
- Single-file backups: copy ~/.anathemabrain/db.sqlite
|
|
143
|
-
- FTS5 + JSON1 support built-in (used by RAG and vault search)
|
|
144
|
-
- Cross-platform: tested on macOS, Linux, Windows
|
|
145
|
-
|
|
146
|
-
### Positive
|
|
147
|
-
- No network round-trip — sub-millisecond reads
|
|
148
|
-
- Embedded = no auth/connection-string management
|
|
149
|
-
- Mature ecosystem (better-sqlite3, sqlite-vss)
|
|
150
|
-
|
|
151
|
-
### Negative
|
|
152
|
-
- Single-writer: concurrent writes are serialized (acceptable for desktop)
|
|
153
|
-
- No horizontal scaling (irrelevant for desktop)
|
|
154
|
-
- Migration tooling requires custom scripts (we have db/migrations.ts)
|
|
155
|
-
|
|
156
|
-
## Alternatives Considered
|
|
157
|
-
- **Postgres**: rejected — requires a server process, overkill for desktop
|
|
158
|
-
- **LevelDB / RocksDB**: rejected — no SQL, harder to query vector data
|
|
159
|
-
- **JSON files**: rejected — no concurrent access, no FTS
|
|
160
|
-
`,
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
outputSchema: '{ path: string; content: string }',
|
|
165
|
-
systemPromptFragment: `You are writing an Architecture Decision Record (ADR).
|
|
166
|
-
|
|
167
|
-
## Required sections
|
|
168
|
-
1. **# N. <Title>** — short title in present tense ("Use X for Y")
|
|
169
|
-
2. **## Context** — what is the situation? What forces are at play? (2-3 paragraphs)
|
|
170
|
-
3. **## Decision** — what did we decide? State it clearly in 1-2 sentences.
|
|
171
|
-
4. **## Consequences** — what becomes easier (+) and harder (-) as a result?
|
|
172
|
-
5. **## Alternatives Considered** — 2-4 alternatives with one-line rejection reasons.
|
|
173
|
-
|
|
174
|
-
## Numbering
|
|
175
|
-
- Check docs/adr/ for the next available number (NNN-title.md format)
|
|
176
|
-
- ADR numbers are permanent — never reuse, even if an ADR is superseded (mark superseded in the body instead)
|
|
177
|
-
|
|
178
|
-
## Tone
|
|
179
|
-
- Factual, not promotional
|
|
180
|
-
- Acknowledge trade-offs honestly
|
|
181
|
-
- Link to relevant code/PRs/files using relative paths
|
|
182
|
-
|
|
183
|
-
Stay under 800 words.${CLARIFICATION_PROTOCOL}`,
|
|
184
|
-
};
|
|
185
|
-
const migrateStack = {
|
|
186
|
-
id: 'migrate-stack',
|
|
187
|
-
version: '1.0.0',
|
|
188
|
-
name: 'Migrate Stack',
|
|
189
|
-
description: 'Plan a migration (framework, language, database, build tool) with phased rollout and a concrete rollback strategy. Identifies big-bang risks and proposes incremental steps.',
|
|
190
|
-
category: 'planning',
|
|
191
|
-
requiredRoles: ['sisyphus', 'prometheus', 'hephaestus'],
|
|
192
|
-
requiredTools: ['createTask', 'searchRAG'],
|
|
193
|
-
estimatedCost: 'high',
|
|
194
|
-
enabledByDefault: true,
|
|
195
|
-
builtin: true,
|
|
196
|
-
triggers: [
|
|
197
|
-
'Replacing a framework (e.g. CRA → Vite, Express → Fastify)',
|
|
198
|
-
'Upgrading a major version with breaking changes (React 17 → 18)',
|
|
199
|
-
'Switching databases (Postgres → SQLite, JSON files → Postgres)',
|
|
200
|
-
'Migrating build tooling (webpack → esbuild, npm → pnpm)',
|
|
201
|
-
'Replacing a key library with a competitor (moment → date-fns)',
|
|
202
|
-
],
|
|
203
|
-
antiPatterns: [
|
|
204
|
-
'Greenfield project — use architect-feature instead',
|
|
205
|
-
'A/B test of two stacks — use a spike/benchmark first',
|
|
206
|
-
'Migration can be done by automated codemods — skip the planning skill',
|
|
207
|
-
],
|
|
208
|
-
requires: ['architect-decision-record', 'scope-check'],
|
|
209
|
-
relatedSkills: ['architect-feature', 'refactor-monolith'],
|
|
210
|
-
tags: ['planning', 'migration', 'rollout', 'rollback', 'risk-management'],
|
|
211
|
-
examples: [
|
|
212
|
-
{
|
|
213
|
-
input: 'Migrate AnathemaBrain from Create React App (CRA) to Vite',
|
|
214
|
-
output: {
|
|
215
|
-
goal: 'Reduce dev server startup from 30s to <2s, reduce prod build from 60s to <10s.',
|
|
216
|
-
phases: [
|
|
217
|
-
{ name: 'Phase 1: Setup parallel build', exitCriterion: 'npm run dev:vite works for a hello-world', durationDays: 2 },
|
|
218
|
-
{ name: 'Phase 2: Migrate entry points', exitCriterion: 'Both Webpack and Vite builds succeed; renderer loads in both', durationDays: 5 },
|
|
219
|
-
{ name: 'Phase 3: Migrate loaders (CSS, assets)', exitCriterion: 'All static assets load correctly under Vite', durationDays: 3 },
|
|
220
|
-
{ name: 'Phase 4: Cut over', exitCriterion: 'Webpack config deleted; CI runs only Vite', durationDays: 2 },
|
|
221
|
-
],
|
|
222
|
-
rollbackStrategy: 'Keep Webpack config in git history (tag: pre-vite-migration). Revert the single commit that switches the default dev script.',
|
|
223
|
-
risks: [
|
|
224
|
-
{ risk: 'Asset paths differ between Webpack and Vite (~/ aliases, ?url imports)', mitigation: 'Phase 3 includes a path-mapping smoke test.' },
|
|
225
|
-
{ risk: 'electron-vite specific electron features not yet stable', mitigation: 'Phase 1 spike verifies electron-vite can compile the existing Electron main process.' },
|
|
226
|
-
],
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
],
|
|
230
|
-
outputSchema: '{ goal: string; phases: Array<{ name: string; exitCriterion: string; durationDays: number }>; rollbackStrategy: string; risks: Array<{ risk: string; mitigation: string }> }',
|
|
231
|
-
systemPromptFragment: `You are planning a stack migration.
|
|
232
|
-
|
|
233
|
-
## Methodology
|
|
234
|
-
1. State the GOAL in measurable terms (e.g. "reduce build time from 60s to 10s").
|
|
235
|
-
2. Decompose into 3-6 phases. Each phase has a CLEAR exit criterion (testable condition).
|
|
236
|
-
3. Each phase should be DEPLOYABLE on its own (no big-bang steps).
|
|
237
|
-
4. Plan a ROLLBACK strategy: which single commit reverts to the previous state?
|
|
238
|
-
5. List 3-7 concrete risks + mitigations per phase.
|
|
239
|
-
|
|
240
|
-
## Migration principles
|
|
241
|
-
- **Strangler Fig**: new system grows alongside old, traffic migrates incrementally
|
|
242
|
-
- **No big-bang rewrites**: every phase must be independently shippable
|
|
243
|
-
- **Reversibility first**: every phase has a tested rollback path
|
|
244
|
-
- **Data migration last**: schema changes follow code changes (dual-write during transition)
|
|
245
|
-
|
|
246
|
-
## Output format (JSON-typed)
|
|
247
|
-
- goal: string (measurable)
|
|
248
|
-
- phases: Array<{ name: string; exitCriterion: string; durationDays: number }>
|
|
249
|
-
- rollbackStrategy: string (the single command or commit that reverts)
|
|
250
|
-
- risks: Array<{ risk: string; mitigation: string }>
|
|
251
|
-
|
|
252
|
-
Stay under 500 words.${CLARIFICATION_PROTOCOL}`,
|
|
253
|
-
};
|
|
254
|
-
const scopeCheck = {
|
|
255
|
-
id: 'scope-check',
|
|
256
|
-
version: '1.0.0',
|
|
257
|
-
name: 'Scope Check',
|
|
258
|
-
description: 'Validate feasibility of a proposed feature or change. Identify hidden costs, dependencies, risks. Propose a reduced scope that fits the available budget.',
|
|
259
|
-
category: 'planning',
|
|
260
|
-
requiredRoles: ['sisyphus', 'oracle', 'chairman'],
|
|
261
|
-
requiredTools: ['searchRAG'],
|
|
262
|
-
estimatedCost: 'medium',
|
|
263
|
-
enabledByDefault: true,
|
|
264
|
-
builtin: true,
|
|
265
|
-
triggers: [
|
|
266
|
-
'User proposes an ambitious feature without a clear MVP boundary',
|
|
267
|
-
'Estimates are unclear or contested',
|
|
268
|
-
'Hidden dependencies suspected (auth, billing, third-party APIs)',
|
|
269
|
-
'Before committing to a multi-week project',
|
|
270
|
-
'When a stakeholder says "this should be easy" and you suspect it is not',
|
|
271
|
-
],
|
|
272
|
-
antiPatterns: [
|
|
273
|
-
'The task is already small and well-scoped — just do it',
|
|
274
|
-
'Pure research / exploration — no commitment to implement',
|
|
275
|
-
'Bug fix — use debug-with-rag instead',
|
|
276
|
-
],
|
|
277
|
-
requires: [],
|
|
278
|
-
relatedSkills: ['architect-feature', 'migrate-stack'],
|
|
279
|
-
tags: ['planning', 'feasibility', 'risk-assessment', 'mvp', 'scoping'],
|
|
280
|
-
examples: [
|
|
281
|
-
{
|
|
282
|
-
input: 'Build a "smart inbox" that categorizes emails using the local LLM council',
|
|
283
|
-
output: {
|
|
284
|
-
feasibility: 'partial',
|
|
285
|
-
estimatedEffortDays: 14,
|
|
286
|
-
hiddenCosts: [
|
|
287
|
-
{ cost: 'IMAP polling + auth setup (3-5 days)', mitigation: 'Use existing Gmail API OAuth2 flow' },
|
|
288
|
-
{ cost: 'Email parsing (HTML, attachments) - 2 days', mitigation: 'Use mailparser library' },
|
|
289
|
-
{ cost: 'Local LLM inference at scale - 1 day setup + per-email ~3s', mitigation: 'Batch categorization, use smaller model (gemini-2.5-flash)' },
|
|
290
|
-
{ cost: 'Council orchestration - already have it', mitigation: 'Reuse runCouncilPure' },
|
|
291
|
-
],
|
|
292
|
-
reducedScope: {
|
|
293
|
-
phase1: 'Single Gmail account, read-only, top-20 inbox categorization (3 days)',
|
|
294
|
-
phase2: 'Multi-account + auto-archive (5 days)',
|
|
295
|
-
phase3: 'Reply drafting suggestions (6 days)',
|
|
296
|
-
},
|
|
297
|
-
risks: [
|
|
298
|
-
'Council API costs: 5 emails × 3 council members × 4 providers = 60 LLM calls per batch',
|
|
299
|
-
'User privacy: emails sent to cloud providers unless restricted to local-only model',
|
|
300
|
-
],
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
],
|
|
304
|
-
outputSchema: '{ feasibility: "yes" | "partial" | "no"; estimatedEffortDays: number; hiddenCosts: Array<{ cost: string; mitigation: string }>; reducedScope: { phase1: string; phase2: string; phase3: string }; risks: string[] }',
|
|
305
|
-
systemPromptFragment: `You are validating the scope of a proposed feature or change.
|
|
306
|
-
|
|
307
|
-
## Methodology
|
|
308
|
-
1. Restate the proposal in ONE sentence.
|
|
309
|
-
2. Search the knowledge base: searchRAG(query="<proposed-keyword>")
|
|
310
|
-
3. Estimate effort realistically (in person-days, with calibration from prior projects).
|
|
311
|
-
4. List HIDDEN costs: auth flows, data migration, third-party APIs, deployment, monitoring.
|
|
312
|
-
5. Propose a REDUCED SCOPE that delivers 80% of the value in 20% of the time.
|
|
313
|
-
6. Flag risks that could block the project.
|
|
314
|
-
|
|
315
|
-
## Output format (JSON-typed)
|
|
316
|
-
- feasibility: 'yes' | 'partial' | 'no'
|
|
317
|
-
- estimatedEffortDays: number
|
|
318
|
-
- hiddenCosts: Array<{ cost: string; mitigation: string }>
|
|
319
|
-
- reducedScope: { phase1: string; phase2: string; phase3: string } (3 phases, each independently shippable)
|
|
320
|
-
- risks: string[] (3-5 risks)
|
|
321
|
-
|
|
322
|
-
## When to be skeptical
|
|
323
|
-
- "Just add X" usually hides auth + persistence + UI work (3x multiplier)
|
|
324
|
-
- "Use the existing system" usually means new integration code
|
|
325
|
-
- Estimates from optimistic people — multiply by 2-3x for calendar time
|
|
326
|
-
|
|
327
|
-
Stay under 400 words. Be honest about feasibility — say NO when the answer is NO.${CLARIFICATION_PROTOCOL}`,
|
|
328
|
-
};
|
|
329
|
-
// Register all 4 skills at module load time in topological dependency order.
|
|
330
|
-
// Throws at startup if any `requires` cross-reference is invalid.
|
|
331
|
-
registerCodingSkill(architectDecisionRecord);
|
|
332
|
-
registerCodingSkill(scopeCheck);
|
|
333
|
-
registerCodingSkill(architectFeature);
|
|
334
|
-
registerCodingSkill(migrateStack);
|
|
335
|
-
//# sourceMappingURL=planning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"planning.js","sourceRoot":"","sources":["../../../../src/agents/skills/builtin/planning.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;kFAamD,CAAC;AAEnF,MAAM,gBAAgB,GAA0B;IAC9C,EAAE,EAAE,mBAAmB;IACvB,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,uIAAuI;IACpJ,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,CAAC;IACnD,aAAa,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC;IAC1C,aAAa,EAAE,MAAM;IACrB,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE;QACR,uCAAuC;QACvC,8CAA8C;QAC9C,uDAA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