nightralph 0.0.2 → 0.0.4

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.
Files changed (93) hide show
  1. package/README.md +113 -34
  2. package/dist/index.js +80 -22
  3. package/dist/index.js.map +2 -2
  4. package/dist/merge.js +194 -0
  5. package/dist/merge.js.map +7 -0
  6. package/dist/meta.json +189 -17
  7. package/dist/orchestrator.js +538 -45
  8. package/dist/orchestrator.js.map +2 -2
  9. package/dist/progress.js +164 -0
  10. package/dist/progress.js.map +7 -0
  11. package/dist/resolve.js +16 -8
  12. package/dist/resolve.js.map +2 -2
  13. package/dist/setup.js +33 -5
  14. package/dist/setup.js.map +2 -2
  15. package/dist/src/index.d.ts.map +1 -1
  16. package/dist/src/merge.d.ts +25 -0
  17. package/dist/src/merge.d.ts.map +1 -0
  18. package/dist/src/orchestrator.d.ts +29 -3
  19. package/dist/src/orchestrator.d.ts.map +1 -1
  20. package/dist/src/progress.d.ts +27 -0
  21. package/dist/src/progress.d.ts.map +1 -0
  22. package/dist/src/resolve.d.ts +2 -1
  23. package/dist/src/resolve.d.ts.map +1 -1
  24. package/dist/src/setup.d.ts +1 -0
  25. package/dist/src/setup.d.ts.map +1 -1
  26. package/dist/src/worktree.d.ts +18 -0
  27. package/dist/src/worktree.d.ts.map +1 -0
  28. package/dist/worktree.js +139 -0
  29. package/dist/worktree.js.map +7 -0
  30. package/package.json +8 -4
  31. package/.claude/settings.local.json +0 -5
  32. package/.github/dependabot.yml +0 -28
  33. package/.github/workflows/nodejs.yml +0 -30
  34. package/AGENTS.md +0 -60
  35. package/CLAUDE.md +0 -1
  36. package/PROMPT.md +0 -95
  37. package/WIP.md +0 -5
  38. package/dist/test/integration.test.js +0 -848
  39. package/dist/test/integration.test.js.map +0 -7
  40. package/dist/test/orchestrator.test.js +0 -749
  41. package/dist/test/orchestrator.test.js.map +0 -7
  42. package/dist/test/setup.test.js +0 -574
  43. package/dist/test/setup.test.js.map +0 -7
  44. package/docs/README.md +0 -12
  45. package/docs/agents/domain.md +0 -36
  46. package/docs/agents/issue-tracker.md +0 -30
  47. package/docs/agents/triage-labels.md +0 -15
  48. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/phase-2-future-work.md +0 -144
  49. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/phase_01.md +0 -292
  50. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/phase_02.md +0 -212
  51. package/docs/implementation-plans/2026-08-27-issue-tracker-choice/test-requirements.md +0 -203
  52. package/docs/skills.md +0 -58
  53. package/docs/test-plans/2026-08-27-issue-tracker-choice.md +0 -95
  54. package/eslint.config.js +0 -142
  55. package/lib.es5.d.ts +0 -19
  56. package/progress.log +0 -190
  57. package/ralph_claude.sh +0 -263
  58. package/scripts/clone-skills.sh +0 -52
  59. package/specs/prd.json +0 -172
  60. package/src/docs-templates/domain.md +0 -36
  61. package/src/docs-templates/issue-tracker-github.md +0 -228
  62. package/src/docs-templates/issue-tracker.md +0 -30
  63. package/src/docs-templates/triage-labels.md +0 -15
  64. package/src/index.ts +0 -184
  65. package/src/orchestrator.ts +0 -324
  66. package/src/resolve.ts +0 -73
  67. package/src/setup.ts +0 -157
  68. package/src/skills/domain-modeling/ADR-FORMAT.md +0 -47
  69. package/src/skills/domain-modeling/CONTEXT-FORMAT.md +0 -60
  70. package/src/skills/domain-modeling/SKILL.md +0 -74
  71. package/src/skills/domain-modeling/agents/openai.yaml +0 -3
  72. package/src/skills/grill/SKILL.md +0 -7
  73. package/src/skills/grill/agents/openai.yaml +0 -5
  74. package/src/skills/grilling/SKILL.md +0 -28
  75. package/src/skills/grilling/agents/openai.yaml +0 -3
  76. package/src/skills/tdd/SKILL.md +0 -38
  77. package/src/skills/tdd/agents/openai.yaml +0 -3
  78. package/src/skills/tdd/mocking.md +0 -59
  79. package/src/skills/tdd/tests.md +0 -77
  80. package/src/skills/to-spec/SKILL.md +0 -75
  81. package/src/skills/to-spec/agents/openai.yaml +0 -5
  82. package/src/skills/to-tickets/SKILL.md +0 -105
  83. package/src/skills/to-tickets/agents/openai.yaml +0 -5
  84. package/src/skills/upstream.json +0 -5
  85. package/tasks/prd-integration-test-coverage.md +0 -243
  86. package/test/integration.test.ts +0 -636
  87. package/test/mock-agent-echo-args.js +0 -4
  88. package/test/mock-agent-fail.js +0 -3
  89. package/test/mock-agent-pass.js +0 -3
  90. package/test/orchestrator.test.ts +0 -609
  91. package/test/setup.test.ts +0 -417
  92. package/tsconfig.build.json +0 -7
  93. package/tsconfig.json +0 -31
@@ -1,324 +0,0 @@
1
- import { spawn } from 'node:child_process'
2
- import {
3
- createWriteStream,
4
- mkdirSync,
5
- readFileSync,
6
- writeFileSync,
7
- readdirSync,
8
- } from 'node:fs'
9
- import { join } from 'node:path'
10
-
11
- export type Ticket = {
12
- num:number
13
- slug:string
14
- filename:string
15
- filepath:string
16
- body:string
17
- status:string
18
- blockers:number[]
19
- }
20
-
21
- export function formatErrorMessage (error:unknown):string {
22
- return error instanceof Error ?
23
- error.message :
24
- String(error)
25
- }
26
-
27
- export const TICKET_RE = /^(\d+)-(.+)\.md$/
28
-
29
- export function parseTicketFilename (
30
- filename:string
31
- ):{ num:number; slug:string }|null {
32
- const m = filename.match(TICKET_RE)
33
- if (!m) return null
34
- return { num:Number(m[1]), slug:m[2] }
35
- }
36
-
37
- export function parseStatus (body:string):string {
38
- const m = body.match(/\*\*Status:\*\*\s*(.+)/i)
39
- return m ? m[1].trim().toLowerCase() : ''
40
- }
41
-
42
- export function parseBlockers (body:string):number[] {
43
- const m = body.match(/\*\*Blocked by:\*\*\s*(.+)/i)
44
- if (!m) return []
45
- const text = m[1]
46
- if (/none/i.test(text)) return []
47
- const nums:number[] = []
48
- const re = /(\d+)/g
49
- let match
50
- while ((match = re.exec(text))) {
51
- nums.push(Number(match[1]))
52
- }
53
- return nums
54
- }
55
-
56
- export function scanTickets (dir:string):Ticket[] {
57
- const files = readdirSync(dir)
58
- .filter(f => TICKET_RE.test(f))
59
- .sort((a, b) => a.localeCompare(
60
- b,
61
- undefined,
62
- { numeric:true, sensitivity:'base' }
63
- ))
64
-
65
- return files.map(filename => {
66
- const parsed = parseTicketFilename(filename)!
67
- const filepath = join(dir, filename)
68
- const body = readFileSync(filepath, 'utf8')
69
- return {
70
- num:parsed.num,
71
- slug:parsed.slug,
72
- filename,
73
- filepath,
74
- body,
75
- status:parseStatus(body),
76
- blockers:parseBlockers(body),
77
- }
78
- })
79
- }
80
-
81
- export function findReadyTickets (
82
- tickets:ReadonlyArray<Ticket>
83
- ):Ticket[] {
84
- const doneNums = new Set(
85
- tickets
86
- .filter(t => t.status !== 'ready-for-agent')
87
- .map(t => t.num)
88
- )
89
- return tickets.filter(t => {
90
- if (t.status !== 'ready-for-agent') return false
91
- return t.blockers.every(b => doneNums.has(b))
92
- })
93
- }
94
-
95
- export function markDone (ticket:Ticket):void {
96
- const updated = ticket.body.replace(
97
- /\*\*Status:\*\*\s*.+/i,
98
- '**Status:** done'
99
- )
100
- writeFileSync(ticket.filepath, updated)
101
- ticket.status = 'done'
102
- ticket.body = updated
103
- }
104
-
105
- export function renderPrompt (
106
- specBody:string,
107
- ticket:Ticket
108
- ):string {
109
- return [
110
- '---- SPEC CONTEXT ----',
111
- specBody,
112
- '',
113
- '---- TICKET ----',
114
- ticket.filename,
115
- ticket.body,
116
- '',
117
- '---- AGENT INSTRUCTIONS ----',
118
- 'You are an autonomous coding agent. ' +
119
- 'Implement the ticket.',
120
- '',
121
- ].join('\n')
122
- }
123
-
124
- export function spawnAgent (opts:{
125
- prompt:string
126
- agentCmd:string
127
- model:string|null
128
- timeoutSecs:number
129
- logPath:string
130
- }):Promise<number> {
131
- const args:string[] = []
132
- if (opts.model) {
133
- args.push('--model', opts.model)
134
- }
135
-
136
- const logStream = createWriteStream(
137
- opts.logPath,
138
- { flags:'w' }
139
- )
140
- const proc = spawn(opts.agentCmd, args, {
141
- stdio:['pipe', 'pipe', 'pipe'],
142
- })
143
-
144
- proc.stdout.pipe(logStream)
145
- proc.stderr.pipe(logStream)
146
-
147
- const timeout = setTimeout(() => {
148
- if (!proc.killed) {
149
- console.warn(
150
- 'Agent did not exit in ' +
151
- `${opts.timeoutSecs}s; killing.`
152
- )
153
- proc.kill('SIGKILL')
154
- }
155
- }, opts.timeoutSecs * 1000)
156
-
157
- proc.stdin.write(opts.prompt)
158
- proc.stdin.end()
159
-
160
- return new Promise<number>(resolve => {
161
- proc.on('close', code => {
162
- clearTimeout(timeout)
163
- logStream.end()
164
- resolve(code ?? 1)
165
- })
166
- proc.on('error', err => {
167
- clearTimeout(timeout)
168
- logStream.end()
169
- console.error(
170
- 'Agent process error:',
171
- formatErrorMessage(err)
172
- )
173
- resolve(1)
174
- })
175
- })
176
- }
177
-
178
- export function dryRun (
179
- tickets:Ticket[],
180
- specBody:string
181
- ):void {
182
- console.log('\nTickets:')
183
- for (const t of tickets) {
184
- const blockerStr = t.blockers.length > 0 ?
185
- `blocked by [${t.blockers.join(', ')}]` :
186
- 'no blockers'
187
- console.log(
188
- ` ${t.filename} ` +
189
- `(${t.status}) ${blockerStr}`
190
- )
191
- }
192
-
193
- console.log('\nSimulated wave order:')
194
- const sim = new Map(
195
- tickets.map(t => [t.num, t.status])
196
- )
197
- let wave = 1
198
- while (true) {
199
- const doneNums = new Set(
200
- [...sim.entries()]
201
- .filter(([, s]) => s !== 'ready-for-agent')
202
- .map(([n]) => n)
203
- )
204
- const ready = tickets.filter(t => {
205
- if (sim.get(t.num) !== 'ready-for-agent') {
206
- return false
207
- }
208
- return t.blockers.every(
209
- b => doneNums.has(b)
210
- )
211
- })
212
- if (ready.length === 0) break
213
- console.log(
214
- ` Wave ${wave}: ` +
215
- ready.map(t => t.filename).join(', ')
216
- )
217
- for (const t of ready) {
218
- sim.set(t.num, 'done')
219
- }
220
- wave++
221
- }
222
-
223
- const stuck = tickets.filter(
224
- t => sim.get(t.num) === 'ready-for-agent'
225
- )
226
- if (stuck.length > 0) {
227
- console.log(
228
- '\nDeadlocked tickets: ' +
229
- stuck.map(t => t.filename).join(', ')
230
- )
231
- }
232
-
233
- const firstReady = findReadyTickets(tickets)
234
- if (firstReady.length > 0) {
235
- console.log(
236
- '\nPrompt for first ready ticket ' +
237
- `(${firstReady[0].filename}):\n`
238
- )
239
- console.log(
240
- renderPrompt(specBody, firstReady[0])
241
- )
242
- }
243
- }
244
-
245
- export async function runWaves (
246
- tickets:Ticket[],
247
- specBody:string,
248
- agentCmd:string,
249
- model:string|null,
250
- timeoutSecs:number,
251
- logsDir:string,
252
- ):Promise<void> {
253
- mkdirSync(logsDir, { recursive:true })
254
-
255
- let totalCompleted = 0
256
- let waveNum = 0
257
-
258
- while (true) {
259
- const ready = findReadyTickets(tickets)
260
- if (ready.length === 0) break
261
-
262
- waveNum++
263
- console.log(
264
- `\nWave ${waveNum}: ` +
265
- ready.map(t => t.filename).join(', ')
266
- )
267
-
268
- const results = await Promise.allSettled(
269
- ready.map(async t => {
270
- const prompt = renderPrompt(specBody, t)
271
- const logPath = join(
272
- logsDir,
273
- t.filename.replace(/\.md$/, '.log')
274
- )
275
- console.log(` Starting ${t.filename}`)
276
- const code = await spawnAgent({
277
- prompt,
278
- agentCmd,
279
- model,
280
- timeoutSecs,
281
- logPath,
282
- })
283
- return { ticket:t, exitCode:code }
284
- })
285
- )
286
-
287
- let waveCompleted = 0
288
- for (const r of results) {
289
- if (r.status === 'rejected') continue
290
- const { ticket, exitCode } = r.value
291
- if (exitCode === 0) {
292
- markDone(ticket)
293
- waveCompleted++
294
- totalCompleted++
295
- console.log(
296
- ` ${ticket.filename}: done`
297
- )
298
- } else {
299
- console.log(
300
- ` ${ticket.filename}: ` +
301
- `agent exited ${exitCode}`
302
- )
303
- }
304
- }
305
-
306
- if (waveCompleted === 0) {
307
- console.log(
308
- '\nNo tickets completed this wave. ' +
309
- 'Stopping.'
310
- )
311
- break
312
- }
313
- }
314
-
315
- const remaining = tickets.filter(
316
- t => t.status === 'ready-for-agent'
317
- )
318
- console.log(
319
- `\nFinished: ${totalCompleted} completed` +
320
- (remaining.length > 0 ?
321
- `, ${remaining.length} remaining` :
322
- '')
323
- )
324
- }
package/src/resolve.ts DELETED
@@ -1,73 +0,0 @@
1
- import { existsSync, readdirSync } from 'node:fs'
2
- import { join } from 'node:path'
3
- import { select } from '@inquirer/prompts'
4
-
5
- export function findFeatureDirs (cwd:string):{
6
- name:string;
7
- dir:string;
8
- spec:string
9
- }[] {
10
- const scratchDir = join(cwd, '.scratch')
11
- if (!existsSync(scratchDir)) return []
12
- const entries = readdirSync(
13
- scratchDir, { withFileTypes:true }
14
- )
15
- const results:{ name:string; dir:string; spec:string }[] = []
16
- for (const entry of entries) {
17
- if (!entry.isDirectory()) continue
18
- const issuesDir = join(
19
- scratchDir, entry.name, 'issues'
20
- )
21
- const specFile = join(
22
- scratchDir, entry.name, 'spec.md'
23
- )
24
- if (existsSync(issuesDir)) {
25
- results.push({
26
- name:entry.name,
27
- dir:issuesDir,
28
- spec:specFile,
29
- })
30
- }
31
- }
32
- return results
33
- }
34
-
35
- export async function resolveIssuesDir (
36
- dirFlag:string|undefined,
37
- specFlag:string|undefined,
38
- cwd:string = process.cwd(),
39
- ):Promise<{ dir:string; spec:string }> {
40
- if (dirFlag && specFlag) {
41
- return { dir:dirFlag, spec:specFlag }
42
- }
43
-
44
- const features = findFeatureDirs(cwd)
45
-
46
- if (features.length === 0) {
47
- console.error(
48
- 'No .scratch/<feature>/issues/ directories ' +
49
- 'found.\nProvide --dir and --spec explicitly.'
50
- )
51
- process.exit(2)
52
- }
53
-
54
- let chosen:typeof features[0]
55
- if (features.length === 1) {
56
- chosen = features[0]
57
- console.log(`Using feature: ${chosen.name}`)
58
- } else {
59
- const name = await select({
60
- message:'Which feature?',
61
- choices:features.map(f => ({
62
- name:f.name,
63
- value:f.name,
64
- })),
65
- })
66
- chosen = features.find(f => f.name === name)!
67
- }
68
-
69
- const dir = dirFlag ?? chosen.dir
70
- const spec = specFlag ?? chosen.spec
71
-
72
- return { dir, spec }
73
- }
package/src/setup.ts DELETED
@@ -1,157 +0,0 @@
1
- import {
2
- cpSync,
3
- existsSync,
4
- mkdirSync,
5
- readdirSync,
6
- readFileSync,
7
- symlinkSync,
8
- writeFileSync,
9
- } from 'node:fs'
10
- import { join } from 'node:path'
11
- import { execSync } from 'node:child_process'
12
-
13
- export const SKILL_DIRS = [
14
- 'grill', 'grilling', 'domain-modeling',
15
- 'to-spec', 'to-tickets', 'tdd',
16
- ] as const
17
-
18
- export const DOC_TEMPLATES = [
19
- 'triage-labels.md',
20
- 'domain.md',
21
- ] as const
22
-
23
- export function checkGhAuth ():boolean {
24
- try {
25
- execSync('gh auth status', { stdio:'ignore' })
26
- return true
27
- } catch {
28
- return false
29
- }
30
- }
31
-
32
- export type TrackerKind = 'github'|'local'
33
-
34
- export type SetupOpts = {
35
- bundledSkillsDir:string
36
- docsTemplatesDir:string
37
- projectDir:string
38
- claude?:boolean
39
- tracker:TrackerKind
40
- }
41
-
42
- const TRACKER_TEMPLATES:Record<TrackerKind, string> = {
43
- local:'issue-tracker.md',
44
- github:'issue-tracker-github.md',
45
- }
46
-
47
- export function setup (opts:SetupOpts):void {
48
- const {
49
- bundledSkillsDir,
50
- docsTemplatesDir,
51
- projectDir,
52
- claude,
53
- tracker,
54
- } = opts
55
- const agentsSkillsDir = join(
56
- projectDir, '.agents', 'skills'
57
- )
58
-
59
- const upstream = JSON.parse(
60
- readFileSync(
61
- join(bundledSkillsDir, 'upstream.json'),
62
- 'utf8'
63
- )
64
- ) as { repo:string; commit:string }
65
-
66
- console.log('Installing skills to .agents/skills/\n')
67
-
68
- for (const skill of SKILL_DIRS) {
69
- const src = join(bundledSkillsDir, skill)
70
- const dest = join(agentsSkillsDir, skill)
71
- mkdirSync(dest, { recursive:true })
72
- cpSync(src, dest, { recursive:true })
73
- const files = readdirSync(src)
74
- console.log(
75
- ` ${skill}/ (${files.join(', ')})`
76
- )
77
- }
78
-
79
- if (claude) {
80
- const claudeSkillsDir = join(
81
- projectDir, '.claude', 'skills'
82
- )
83
- mkdirSync(claudeSkillsDir, { recursive:true })
84
-
85
- for (const skill of SKILL_DIRS) {
86
- const linkPath = join(claudeSkillsDir, skill)
87
- const target = join(
88
- '..', '..', '.agents', 'skills', skill
89
- )
90
- if (existsSync(linkPath)) continue
91
- symlinkSync(target, linkPath)
92
- }
93
-
94
- console.log(
95
- '\nCreated symlinks in .claude/skills/'
96
- )
97
- }
98
-
99
- const docsAgentsDir = join(
100
- projectDir, 'docs', 'agents'
101
- )
102
- mkdirSync(docsAgentsDir, { recursive:true })
103
-
104
- console.log('')
105
- for (const tmpl of DOC_TEMPLATES) {
106
- const dest = join(docsAgentsDir, tmpl)
107
- if (existsSync(dest)) {
108
- console.log(
109
- ` docs/agents/${tmpl} (already exists)`
110
- )
111
- continue
112
- }
113
- const src = join(docsTemplatesDir, tmpl)
114
- writeFileSync(dest, readFileSync(src, 'utf8'))
115
- console.log(` docs/agents/${tmpl} (created)`)
116
- }
117
-
118
- const trackerSrc = join(
119
- docsTemplatesDir, TRACKER_TEMPLATES[tracker]
120
- )
121
- const trackerDest = join(docsAgentsDir, 'issue-tracker.md')
122
- writeFileSync(trackerDest, readFileSync(trackerSrc, 'utf8'))
123
- console.log(
124
- ` docs/agents/issue-tracker.md (${tracker})`
125
- )
126
-
127
- const trackerLine = tracker === 'github' ?
128
- 'Issues are tracked via GitHub Issues using the `gh` ' +
129
- 'CLI.' :
130
- 'Issues are tracked as local markdown files under ' +
131
- '`.scratch/`.'
132
-
133
- const agentsMd = [
134
- '## Agent skills',
135
- '',
136
- '### Issue tracker',
137
- '',
138
- `${trackerLine} See \`docs/agents/issue-tracker.md\`.`,
139
- '',
140
- '### Triage labels',
141
- '',
142
- 'Default label vocabulary. See ' +
143
- '`docs/agents/triage-labels.md`.',
144
- '',
145
- '### Domain docs',
146
- '',
147
- 'Single-context layout. See `docs/agents/domain.md`.',
148
- '',
149
- ].join('\n')
150
-
151
- writeFileSync(join(projectDir, 'AGENTS.md'), agentsMd)
152
- console.log('\n AGENTS.md (updated)')
153
-
154
- console.log(
155
- `\nSource: ${upstream.repo} @ ${upstream.commit}`
156
- )
157
- }
@@ -1,47 +0,0 @@
1
- # ADR Format
2
-
3
- ADRs live in `docs/adr/` and use sequential numbering: `0001-slug.md`, `0002-slug.md`, etc.
4
-
5
- Create the `docs/adr/` directory lazily: only when the first ADR is needed.
6
-
7
- ## Template
8
-
9
- ```md
10
- # {Short title of the decision}
11
-
12
- {1-3 sentences: what's the context, what did we decide, and why.}
13
- ```
14
-
15
- That's it. An ADR can be a single paragraph. The value is in recording *that* a decision was made and *why*, not in filling out sections.
16
-
17
- ## Optional sections
18
-
19
- Only include these when they add genuine value. Most ADRs won't need them.
20
-
21
- - **Status** frontmatter (`proposed | accepted | deprecated | superseded by ADR-NNNN`): useful when decisions are revisited
22
- - **Considered Options**: only when the rejected alternatives are worth remembering
23
- - **Consequences**: only when non-obvious downstream effects need to be called out
24
-
25
- ## Numbering
26
-
27
- Scan `docs/adr/` for the highest existing number and increment by one.
28
-
29
- ## When to offer an ADR
30
-
31
- All three of these must be true:
32
-
33
- 1. **Hard to reverse**: the cost of changing your mind later is meaningful
34
- 2. **Surprising without context**: a future reader will look at the code and wonder "why on earth did they do it this way?"
35
- 3. **The result of a real trade-off**: there were genuine alternatives and you picked one for specific reasons
36
-
37
- If a decision is easy to reverse, skip it: you'll just reverse it. If it's not surprising, nobody will wonder why. If there was no real alternative, there's nothing to record beyond "we did the obvious thing."
38
-
39
- ### What qualifies
40
-
41
- - **Architectural shape.** "We're using a monorepo." "The write model is event-sourced, the read model is projected into Postgres."
42
- - **Integration patterns between contexts.** "Ordering and Billing communicate via domain events, not synchronous HTTP."
43
- - **Technology choices that carry lock-in.** Database, message bus, auth provider, deployment target. Not every library: just the ones that would take a quarter to swap out.
44
- - **Boundary and scope decisions.** "Customer data is owned by the Customer context; other contexts reference it by ID only." The explicit no-s are as valuable as the yes-s.
45
- - **Deliberate deviations from the obvious path.** "We're using manual SQL instead of an ORM because X." Anything where a reasonable reader would assume the opposite. These stop the next engineer from "fixing" something that was deliberate.
46
- - **Constraints not visible in the code.** "We can't use AWS because of compliance requirements." "Response times must be under 200ms because of the partner API contract."
47
- - **Rejected alternatives when the rejection is non-obvious.** If you considered GraphQL and picked REST for subtle reasons, record it; otherwise someone will suggest GraphQL again in six months.
@@ -1,60 +0,0 @@
1
- # CONTEXT.md Format
2
-
3
- ## Structure
4
-
5
- ```md
6
- # {Context Name}
7
-
8
- {One or two sentence description of what this context is and why it exists.}
9
-
10
- ## Language
11
-
12
- **Order**:
13
- {A one or two sentence description of the term}
14
- _Avoid_: Purchase, transaction
15
-
16
- **Invoice**:
17
- A request for payment sent to a customer after delivery.
18
- _Avoid_: Bill, payment request
19
-
20
- **Customer**:
21
- A person or organization that places orders.
22
- _Avoid_: Client, buyer, account
23
- ```
24
-
25
- ## Rules
26
-
27
- - **Be opinionated.** When multiple words exist for the same concept, pick the best one and list the others under `_Avoid_`.
28
- - **Keep definitions tight.** One or two sentences max. Define what it IS, not what it does.
29
- - **Only include terms specific to this project's context.** General programming concepts (timeouts, error types, utility patterns) don't belong even if the project uses them extensively. Before adding a term, ask: is this a concept unique to this context, or a general programming concept? Only the former belongs.
30
- - **Group terms under subheadings** when natural clusters emerge. If all terms belong to a single cohesive area, a flat list is fine.
31
-
32
- ## Single vs multi-context repos
33
-
34
- **Single context (most repos):** One `CONTEXT.md` at the repo root.
35
-
36
- **Multiple contexts:** A `CONTEXT-MAP.md` at the repo root lists the contexts, where they live, and how they relate to each other:
37
-
38
- ```md
39
- # Context Map
40
-
41
- ## Contexts
42
-
43
- - [Ordering](./src/ordering/CONTEXT.md): receives and tracks customer orders
44
- - [Billing](./src/billing/CONTEXT.md): generates invoices and processes payments
45
- - [Fulfillment](./src/fulfillment/CONTEXT.md): manages warehouse picking and shipping
46
-
47
- ## Relationships
48
-
49
- - **Ordering → Fulfillment**: Ordering emits `OrderPlaced` events; Fulfillment consumes them to start picking
50
- - **Fulfillment → Billing**: Fulfillment emits `ShipmentDispatched` events; Billing consumes them to generate invoices
51
- - **Ordering ↔ Billing**: Shared types for `CustomerId` and `Money`
52
- ```
53
-
54
- The skill infers which structure applies:
55
-
56
- - If `CONTEXT-MAP.md` exists, read it to find contexts
57
- - If only a root `CONTEXT.md` exists, single context
58
- - If neither exists, create a root `CONTEXT.md` lazily when the first term is resolved
59
-
60
- When multiple contexts exist, infer which one the current topic relates to. If unclear, ask.