@sddio/cli 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -40
- package/dist/agents.js +3 -1
- package/dist/brief.js +104 -0
- package/dist/check.js +109 -0
- package/dist/claims.js +60 -0
- package/dist/cli.js +222 -21
- package/dist/cursor.js +65 -0
- package/dist/events.js +37 -0
- package/dist/hooks.js +68 -0
- package/dist/init.js +62 -7
- package/dist/prompt.js +13 -11
- package/dist/repo.js +93 -0
- package/dist/workspace.js +3 -8
- package/package.json +3 -3
- package/templates/.sddio/context/README.md +0 -1
- package/templates/.sddio/context/config.json +14 -3
- package/templates/.sddio/context/instructions/adr.md +7 -0
- package/templates/.sddio/context/instructions/bootstrap.md +28 -16
- package/templates/.sddio/context/instructions/entries.md +10 -0
- package/templates/.sddio/context/instructions/reconciliation.md +12 -12
- package/templates/.sddio/context/instructions/spec.md +15 -0
- package/templates/.sddio/context/instructions.md +35 -120
- package/templates/.sddio/context/routes/routes.md +3 -2
- package/templates/.sddio/context/writing.md +80 -0
- package/dist/skill.js +0 -18
- package/templates/.sddio/context/instructions/flow.md +0 -45
- package/templates/.sddio/context/principles.md +0 -46
- package/templates/.sddio/skill/SKILL.md +0 -33
package/dist/repo.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the workspace is, and what is in it.
|
|
3
|
+
*
|
|
4
|
+
* Every read-side command needs the same three things: the repository root, the
|
|
5
|
+
* cursor, and the entries. They live here so `brief`, `check`, `diff` and `start`
|
|
6
|
+
* cannot disagree about what an entry is.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
9
|
+
import { dirname, join, resolve } from 'node:path';
|
|
10
|
+
import { WORKSPACE_ROOT } from './workspace.js';
|
|
11
|
+
const COLLECTIONS = [
|
|
12
|
+
{ dir: 'spec', kind: 'SPEC' },
|
|
13
|
+
{ dir: 'adr', kind: 'ADR' },
|
|
14
|
+
{ dir: 'discussions', kind: 'DISC' },
|
|
15
|
+
];
|
|
16
|
+
/** Walk up from `start` until a `.sddio/context/config.json` appears. */
|
|
17
|
+
export function findRoot(start) {
|
|
18
|
+
let current = resolve(start);
|
|
19
|
+
for (;;) {
|
|
20
|
+
if (existsSync(join(current, '.sddio', 'context', 'config.json'))) {
|
|
21
|
+
return current;
|
|
22
|
+
}
|
|
23
|
+
const parent = dirname(current);
|
|
24
|
+
if (parent === current) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
current = parent;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function readConfig(root) {
|
|
31
|
+
try {
|
|
32
|
+
return JSON.parse(readFileSync(join(root, '.sddio', 'context', 'config.json'), 'utf8'));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function parseEntries(file, kind, text) {
|
|
39
|
+
const blocks = text.split(/^<!-- entry -->$/m).slice(1);
|
|
40
|
+
return blocks
|
|
41
|
+
.map((block) => {
|
|
42
|
+
const id = /^id:\s*(\S+)\s*$/m.exec(block)?.[1];
|
|
43
|
+
const title = /^##\s+(.+?)\s*$/m.exec(block)?.[1];
|
|
44
|
+
if (id === undefined || title === undefined) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const start = block.indexOf('\n---', block.indexOf('---') + 1);
|
|
48
|
+
const after = block.slice(start + 4).trim();
|
|
49
|
+
const body = after.replace(/^##\s+.+?\s*$/m, '').trim();
|
|
50
|
+
const refs = (block.match(/^refs:\s*\[([^\]]*)\]/m)?.[1] ?? '')
|
|
51
|
+
.split(',')
|
|
52
|
+
.map((ref) => ref.trim())
|
|
53
|
+
.filter((ref) => ref !== '');
|
|
54
|
+
const status = block.match(/^status:\s*(\S+)/m)?.[1] ?? '';
|
|
55
|
+
return { id, kind, title, body, file, refs, status };
|
|
56
|
+
})
|
|
57
|
+
.filter((entry) => entry !== null);
|
|
58
|
+
}
|
|
59
|
+
/** Every entry, in collection order then file order. Unreadable files are skipped. */
|
|
60
|
+
export function readEntries(root) {
|
|
61
|
+
const entries = [];
|
|
62
|
+
for (const { dir, kind } of COLLECTIONS) {
|
|
63
|
+
const directory = join(root, WORKSPACE_ROOT, dir);
|
|
64
|
+
if (!existsSync(directory)) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
for (const name of readdirSync(directory).filter((file) => file.endsWith('.md')).sort()) {
|
|
68
|
+
const file = `${WORKSPACE_ROOT}/${dir}/${name}`;
|
|
69
|
+
try {
|
|
70
|
+
entries.push(...parseEntries(file, kind, readFileSync(join(root, file), 'utf8')));
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// A collection that cannot be read is a missing collection, not a crash.
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return entries;
|
|
78
|
+
}
|
|
79
|
+
/** Path-like tokens an entry body names: `packages/cli/lib/init.ts`, `init.ts`, `lib/`. */
|
|
80
|
+
export function pathsIn(body) {
|
|
81
|
+
const tokens = body.match(/[\w./-]*[A-Za-z0-9_-]+\.[A-Za-z0-9]+|\b[\w.-]+\/[\w./-]+/g) ?? [];
|
|
82
|
+
return [...new Set(tokens.map((token) => token.replace(/[.,;:)]+$/, '')))].filter((token) => token.includes('.') || token.includes('/'));
|
|
83
|
+
}
|
|
84
|
+
/** Does `entry` name `target`? Full path, basename, or a directory prefix of it. */
|
|
85
|
+
export function entryNames(entry, target) {
|
|
86
|
+
const clean = target.replace(/^\.\//, '');
|
|
87
|
+
return pathsIn(entry.body).some((token) => {
|
|
88
|
+
if (clean === token || clean.endsWith(`/${token}`) || token.endsWith(`/${clean}`)) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
return token.endsWith('/') && clean.startsWith(token);
|
|
92
|
+
});
|
|
93
|
+
}
|
package/dist/workspace.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `
|
|
2
|
+
* `sddio_docs/` layout (ADR-001, ADR-005).
|
|
3
3
|
*
|
|
4
4
|
* The workspace is user-owned, so init reproduces the layout and nothing else:
|
|
5
5
|
* the directories plus empty seed files. Seeds ship empty on purpose — they
|
|
@@ -9,22 +9,17 @@
|
|
|
9
9
|
* Empty directories cannot travel through `npm pack`, so the layout is
|
|
10
10
|
* declared here instead of being carried by the tarball.
|
|
11
11
|
*/
|
|
12
|
-
export const WORKSPACE_ROOT = '
|
|
12
|
+
export const WORKSPACE_ROOT = 'sddio_docs';
|
|
13
13
|
/** Created unconditionally, including the empty ones a template cannot carry. */
|
|
14
14
|
export const WORKSPACE_DIRS = [
|
|
15
15
|
WORKSPACE_ROOT,
|
|
16
16
|
`${WORKSPACE_ROOT}/spec`,
|
|
17
17
|
`${WORKSPACE_ROOT}/adr`,
|
|
18
18
|
`${WORKSPACE_ROOT}/discussions`,
|
|
19
|
-
`${WORKSPACE_ROOT}/flow`,
|
|
20
|
-
`${WORKSPACE_ROOT}/flow/active`,
|
|
21
|
-
`${WORKSPACE_ROOT}/flow/completed`,
|
|
22
|
-
`${WORKSPACE_ROOT}/flow/reconciliation`,
|
|
23
19
|
];
|
|
24
|
-
/** Entry home files
|
|
20
|
+
/** Entry home files: one numbered collection per artifact type (ADR-004). */
|
|
25
21
|
export const WORKSPACE_SEEDS = [
|
|
26
22
|
`${WORKSPACE_ROOT}/spec/spec_100.md`,
|
|
27
23
|
`${WORKSPACE_ROOT}/adr/adr_100.md`,
|
|
28
24
|
`${WORKSPACE_ROOT}/discussions/discussions_100.md`,
|
|
29
|
-
`${WORKSPACE_ROOT}/flow/active/template.md`,
|
|
30
25
|
];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sddio/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Spec-driven development for coding agents: keep SPEC, ADR
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Spec-driven development for coding agents: keep SPEC, ADR and DISCUSSION in your repo so the reasoning survives session restarts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
44
|
"sync": "node scripts/sync-templates.mjs",
|
|
45
|
-
"prebuild": "npm run sync",
|
|
45
|
+
"prebuild": "npm run clean && npm run sync",
|
|
46
46
|
"build": "tsc -p tsconfig.json",
|
|
47
47
|
"pretest": "npm run build",
|
|
48
48
|
"test": "node --test test/*.test.mjs",
|
|
@@ -26,7 +26,6 @@ sddio separates project context into a few focused artifacts:
|
|
|
26
26
|
- **SPEC** — what the system should do
|
|
27
27
|
- **ADR** — why important technical decisions were made
|
|
28
28
|
- **DISCUSSION** — unresolved questions, concerns, suggestions, and ideas
|
|
29
|
-
- **FLOW** — what is currently being worked on
|
|
30
29
|
- **ROADMAP** — future direction
|
|
31
30
|
- **PREFERENCES** — stable project or user context
|
|
32
31
|
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion":
|
|
3
|
-
"
|
|
4
|
-
|
|
2
|
+
"schemaVersion": 3,
|
|
3
|
+
"reconcileCursor": {
|
|
4
|
+
"lastProcessedCommit": null,
|
|
5
|
+
"previousCommit": null
|
|
6
|
+
},
|
|
7
|
+
"hooks": [
|
|
8
|
+
{
|
|
9
|
+
"id": "flow-trail",
|
|
10
|
+
"kind": "external",
|
|
11
|
+
"events": [
|
|
12
|
+
"knowledge.reconcile"
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
]
|
|
5
16
|
}
|
|
@@ -29,6 +29,13 @@ Do not create an `ADR` for:
|
|
|
29
29
|
- Omit any section that has nothing to say.
|
|
30
30
|
- Follow Entry Style in `instructions.md`.
|
|
31
31
|
|
|
32
|
+
## What belongs here
|
|
33
|
+
|
|
34
|
+
- A choice that was made, the option that lost, and what each cost.
|
|
35
|
+
- History the code cannot carry: what was tried, what failed, who asked, by when.
|
|
36
|
+
- Not falsifiable. An `ADR` is superseded, never corrected in place.
|
|
37
|
+
- If a command could prove it, it is a `SPEC`, and only the reason stays here.
|
|
38
|
+
|
|
32
39
|
## Rule
|
|
33
40
|
|
|
34
41
|
Record the decision and why it matters.
|
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
# Bootstrap
|
|
2
2
|
|
|
3
|
-
Bootstrap
|
|
3
|
+
Bootstrap establishes the smallest workspace an existing project can use. It is not a documentation
|
|
4
|
+
pass, and it does not describe the implementation back to the reader.
|
|
5
|
+
|
|
6
|
+
## What can be recovered
|
|
7
|
+
|
|
8
|
+
Only what the repository does not already say:
|
|
9
|
+
|
|
10
|
+
- a decision that was made and then reversed, and why
|
|
11
|
+
- a constraint imposed from outside: who asked, and by when
|
|
12
|
+
- a path that was tried and abandoned
|
|
13
|
+
|
|
14
|
+
## What cannot
|
|
15
|
+
|
|
16
|
+
Behaviour, layout, flags, file lists, and the shape of a module. Those are in the repository and will
|
|
17
|
+
be read there, cheaper and fresher than any summary.
|
|
4
18
|
|
|
5
19
|
## Process
|
|
6
20
|
|
|
7
|
-
1.
|
|
8
|
-
2.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
9. Write the route table described below.
|
|
21
|
+
1. Read history, not code: renames, deletions and rewrites (`git log --diff-filter=DR --name-status`).
|
|
22
|
+
2. Write at most six `SPEC` entries. Each is a requirement a command could falsify, and each ends with
|
|
23
|
+
`- Not in the code: <why the repository does not say it>`.
|
|
24
|
+
3. Write an `ADR` only for a reversal you can date and explain. Omit the rest.
|
|
25
|
+
4. Ask the user up to three questions — the ones whose answers would change future work, and which the
|
|
26
|
+
repository cannot answer.
|
|
27
|
+
5. Record at least one `DISCUSSION` for what stays open (SPEC-016).
|
|
28
|
+
6. Write the route table described below.
|
|
16
29
|
|
|
17
30
|
## Route Table
|
|
18
31
|
|
|
19
|
-
Bootstrap writes `
|
|
32
|
+
Bootstrap writes `sddio_docs/README.md`, the index that makes its own output findable.
|
|
20
33
|
|
|
21
34
|
- One row per area that has entries — not one row per entry.
|
|
22
35
|
- A row names the area, the `SPEC` range it holds, the `ADR` that governs it, and one sentence of scope.
|
|
@@ -31,12 +44,11 @@ Bootstrap writes a `SPEC` of claims, so it also writes the doubt that qualifies
|
|
|
31
44
|
- Record the single most material gap — the one whose answer would change future work.
|
|
32
45
|
- Prefer: intent behind the code, unverified external dependencies, competing interpretations of the same module.
|
|
33
46
|
- Add a second entry only when it changes a different decision; this is a floor, not a quota.
|
|
34
|
-
- The entry satisfies `instructions/discussion.md`; code records structure, not intent, so a real gap always exists.
|
|
35
47
|
- Never record a decorative question to satisfy this rule.
|
|
36
48
|
|
|
37
49
|
## Limits
|
|
38
50
|
|
|
39
|
-
-
|
|
40
|
-
- Do not
|
|
41
|
-
- Do not repeatedly scan
|
|
42
|
-
-
|
|
51
|
+
- A bootstrap that produces twenty entries has produced a paraphrase. Six is the ceiling, not the goal.
|
|
52
|
+
- Do not restate rules that `.sddio/context/instructions/` already ships.
|
|
53
|
+
- Do not repeatedly scan what is already captured in `SPEC`.
|
|
54
|
+
- A question is cheaper than a wrong claim; ask before inventing.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Entries
|
|
2
2
|
|
|
3
|
+
## Admission
|
|
4
|
+
|
|
5
|
+
An entry is written only for a fact that reading the implementation cannot give you.
|
|
6
|
+
|
|
7
|
+
- Answer one line before writing: `Not in the code: <why the repository does not say this>`.
|
|
8
|
+
- If that line cannot be written, there is no entry. Not a shorter one — none.
|
|
9
|
+
- A fact the code or a shipped instruction already states is a citation: point at it with `refs`, do not copy it.
|
|
10
|
+
- A fact that can be regenerated by reading one file is not knowledge; it is a second copy that will drift.
|
|
11
|
+
- History is admissible: what was tried, what failed, who asked, and by when.
|
|
12
|
+
|
|
3
13
|
## Schema
|
|
4
14
|
|
|
5
15
|
Before creating or modifying an `ADR`, `DISCUSSION`, or `SPEC` entry:
|
|
@@ -6,11 +6,12 @@ Reconciliation keeps durable project knowledge consistent with implementation.
|
|
|
6
6
|
|
|
7
7
|
- **Startup** — the commit check runs on every session, before any work.
|
|
8
8
|
- **After work** — after meaningful implementation changes.
|
|
9
|
+
- **Hook** — when a hook declared in `config.json` covers `knowledge.reconcile`.
|
|
9
10
|
- **Conflict** — when implementation and artifacts disagree.
|
|
10
11
|
|
|
11
12
|
## Commit Check
|
|
12
13
|
|
|
13
|
-
Read `.sddio/context/config.json`, then resolve
|
|
14
|
+
Read `reconcileCursor` in `.sddio/context/config.json`, then resolve it with git.
|
|
14
15
|
|
|
15
16
|
- `HEAD` — `git rev-parse HEAD`
|
|
16
17
|
- Exists — `git cat-file -e <sha>^{commit}`
|
|
@@ -18,13 +19,13 @@ Read `.sddio/context/config.json`, then resolve the cursor with git.
|
|
|
18
19
|
|
|
19
20
|
Evaluate in order; stop at the first match.
|
|
20
21
|
|
|
21
|
-
| State | Condition
|
|
22
|
-
| --------- |
|
|
23
|
-
| current | `lastProcessedCommit` equals `HEAD`
|
|
24
|
-
| ahead | it is an ancestor of `HEAD`
|
|
25
|
-
| rewritten | it exists, is not an ancestor
|
|
26
|
-
| lost | it is gone, `previousCommit` is ancestor
|
|
27
|
-
| unknown | `null`, absent, or unresolvable
|
|
22
|
+
| State | Condition | Range |
|
|
23
|
+
| --------- | ------------------------------------------------ | ---------------- |
|
|
24
|
+
| current | `reconcileCursor.lastProcessedCommit` equals `HEAD` | none |
|
|
25
|
+
| ahead | it is an ancestor of `HEAD` | `last..HEAD` |
|
|
26
|
+
| rewritten | it exists, is not an ancestor | `last...HEAD` |
|
|
27
|
+
| lost | it is gone, `previousCommit` is an ancestor | `previous..HEAD` |
|
|
28
|
+
| unknown | `null`, absent, or unresolvable | current state |
|
|
28
29
|
|
|
29
30
|
- `current` — no reconciliation; continue with the request.
|
|
30
31
|
- `ahead` — reconcile only the new commits.
|
|
@@ -39,9 +40,9 @@ Evaluate in order; stop at the first match.
|
|
|
39
40
|
|
|
40
41
|
After reconciliation completes:
|
|
41
42
|
|
|
42
|
-
1. `previousCommit` ← `HEAD^`; `null` at a root commit.
|
|
43
|
-
2. `lastProcessedCommit` ← `HEAD`.
|
|
44
|
-
3. Preserve `schemaVersion`.
|
|
43
|
+
1. `reconcileCursor.previousCommit` ← `HEAD^`; `null` at a root commit.
|
|
44
|
+
2. `reconcileCursor.lastProcessedCommit` ← `HEAD`.
|
|
45
|
+
3. Preserve `schemaVersion` and `hooks`.
|
|
45
46
|
4. Write nothing when the state was `current`.
|
|
46
47
|
|
|
47
48
|
- Write only after the artifacts are updated.
|
|
@@ -63,7 +64,6 @@ Check only affected:
|
|
|
63
64
|
- `SPEC`
|
|
64
65
|
- `ADR`
|
|
65
66
|
- `DISCUSSION`
|
|
66
|
-
- `FLOW`
|
|
67
67
|
|
|
68
68
|
Both sides of the range, by name:
|
|
69
69
|
|
|
@@ -17,6 +17,21 @@ Create or update `SPEC` when:
|
|
|
17
17
|
- The title names the requirement; the body does not repeat it.
|
|
18
18
|
- Follow Entry Style in `instructions.md`.
|
|
19
19
|
|
|
20
|
+
## What belongs here
|
|
21
|
+
|
|
22
|
+
- A requirement a command could falsify. If no command could fail, it is an `ADR`.
|
|
23
|
+
- The smallest statement a test could assert, and the check that asserts it.
|
|
24
|
+
- What must stay true when the code changes — not a description of how it works now.
|
|
25
|
+
- Not a copy of a rule that `.sddio/context/instructions/` already ships.
|
|
26
|
+
- Not a layout, a file list, or a flag's behaviour: those are read from the repository.
|
|
27
|
+
|
|
28
|
+
## Claims
|
|
29
|
+
|
|
30
|
+
- A bullet may carry one line: `- Check: <command> → <expected substring>`.
|
|
31
|
+
- `sddio check --claims` runs it at the repository root and compares the output.
|
|
32
|
+
- A claim whose command fails, or whose output misses the text, is drift — reported, not crashed.
|
|
33
|
+
- A bullet without a claim is acceptable. A claim nobody can run is not.
|
|
34
|
+
|
|
20
35
|
## Rules
|
|
21
36
|
|
|
22
37
|
- Record what the system must do, not how it is implemented.
|
|
@@ -2,148 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
## Startup
|
|
4
4
|
|
|
5
|
-
1.
|
|
6
|
-
2. Read `preferences.md
|
|
7
|
-
3. Read `
|
|
8
|
-
4.
|
|
9
|
-
5. Run the commit check
|
|
10
|
-
6. Identify the current intent
|
|
11
|
-
7. Load only the minimum context required
|
|
12
|
-
8. Load detailed instructions only when required
|
|
5
|
+
1. Run `npx sddio start`, and read what it prints.
|
|
6
|
+
2. Read `preferences.md`.
|
|
7
|
+
3. Read `writing.md` when you are about to create or change an entry — not before.
|
|
8
|
+
4. Load `instructions/<artifact>.md` only for the artifact you are writing.
|
|
13
9
|
|
|
14
10
|
If no usable `SPEC` exists, load `instructions/bootstrap.md`.
|
|
15
11
|
|
|
16
|
-
##
|
|
12
|
+
## The cursor
|
|
17
13
|
|
|
18
|
-
`config.json`
|
|
14
|
+
`config.json` holds `reconcileCursor` and `hooks`. `start` resolves the first and prints the
|
|
15
|
+
second's effect. States, ranges and edge cases: `instructions/reconciliation.md`.
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
"schemaVersion": 2,
|
|
23
|
-
"lastProcessedCommit": "<sha>",
|
|
24
|
-
"previousCommit": "<sha>"
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
- `lastProcessedCommit` — `HEAD` when reconciliation last completed.
|
|
29
|
-
- `previousCommit` — parent of `lastProcessedCommit`.
|
|
30
|
-
- Two commits are recorded so a rewritten or vanished tip still has an anchor.
|
|
31
|
-
- `null` means no baseline yet; the first run establishes one.
|
|
32
|
-
|
|
33
|
-
| State | Cursor condition | Reconcile |
|
|
34
|
-
| --------- | ------------------------------------- | ---------------- |
|
|
35
|
-
| current | equals `HEAD` | nothing |
|
|
36
|
-
| ahead | ancestor of `HEAD` | `cursor..HEAD` |
|
|
37
|
-
| rewritten | present, not an ancestor | `cursor...HEAD` |
|
|
38
|
-
| lost | gone, `previousCommit` is an ancestor | `previous..HEAD` |
|
|
39
|
-
| unknown | `null`, missing, or unresolvable | current state |
|
|
40
|
-
|
|
41
|
-
- Rows are ordered; the first match wins.
|
|
42
|
-
- Advance the cursor only after reconciliation completes.
|
|
17
|
+
- Behind or rewritten — reconcile before the next decision, not after the next commit.
|
|
43
18
|
- The cursor records commits, not uncommitted work.
|
|
44
|
-
-
|
|
45
|
-
- Procedure and edge cases: `instructions/reconciliation.md`.
|
|
46
|
-
|
|
47
|
-
## Core Loop
|
|
48
|
-
|
|
49
|
-
All work follows:
|
|
50
|
-
|
|
51
|
-
```text
|
|
52
|
-
Observe → Classify → Act → Reconcile
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Observe
|
|
56
|
-
|
|
57
|
-
Gather only the information required for the current task.
|
|
19
|
+
- A hook is a declaration. sddio never calls one.
|
|
58
20
|
|
|
59
|
-
|
|
21
|
+
## Finding things
|
|
60
22
|
|
|
61
|
-
|
|
23
|
+
- `sddio brief <path>` — entries that name those paths, titles only.
|
|
24
|
+
- `sddio show <id>` — one entry, body included.
|
|
25
|
+
- `sddio diff` — which entries a moved file touches, and which files nobody named.
|
|
26
|
+
- No command? `grep -rn "^## " sddio_docs/*/` lists the whole index.
|
|
62
27
|
|
|
63
|
-
Classify
|
|
28
|
+
## Classify
|
|
64
29
|
|
|
65
30
|
```text
|
|
66
|
-
Requirement → SPEC
|
|
67
|
-
Decision → ADR
|
|
31
|
+
Requirement → SPEC a command could falsify it
|
|
32
|
+
Decision → ADR only a person can be told why
|
|
68
33
|
Uncertainty → DISCUSSION
|
|
69
|
-
Work → FLOW
|
|
70
34
|
Transient → nothing
|
|
71
35
|
```
|
|
72
36
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
### Act
|
|
76
|
-
|
|
77
|
-
Load the relevant detailed instruction before creating or modifying an artifact.
|
|
78
|
-
|
|
79
|
-
Prefer updating existing artifacts over creating duplicates.
|
|
37
|
+
Work in progress is not a classification. Plans belong to `flow-trail`.
|
|
80
38
|
|
|
81
|
-
|
|
39
|
+
## Entry style
|
|
82
40
|
|
|
83
|
-
|
|
41
|
+
One idea per line. Bullets over paragraphs. Under ~100 characters. Facts only, no history.
|
|
42
|
+
Do not restate the title. Reference by ID; never repeat content. One level of nesting.
|
|
43
|
+
Omit a section that has nothing to say. Two sentences are two bullets.
|
|
84
44
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
A resolved `DISCUSSION` is promoted into `SPEC` or `ADR`, then deleted — see `instructions/discussion.md`.
|
|
88
|
-
|
|
89
|
-
## Knowledge Rule
|
|
90
|
-
|
|
91
|
-
Record information only when it is likely to affect future work.
|
|
92
|
-
|
|
93
|
-
Do not record information merely because it was observed.
|
|
94
|
-
|
|
95
|
-
Prefer the smallest artifact that preserves future usefulness.
|
|
96
|
-
|
|
97
|
-
## Artifact Roles
|
|
98
|
-
|
|
99
|
-
- `SPEC` — confirmed system requirements
|
|
100
|
-
- `ADR` — important technical decisions
|
|
101
|
-
- `DISCUSSION` — unresolved knowledge
|
|
102
|
-
- `FLOW` — implementation work
|
|
103
|
-
|
|
104
|
-
Keep these roles distinct.
|
|
105
|
-
|
|
106
|
-
## Entry Style
|
|
45
|
+
Shape test: every line is readable and actionable on its own.
|
|
107
46
|
|
|
108
|
-
|
|
47
|
+
## Where the detail lives
|
|
109
48
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
8. One level of nesting at most.
|
|
118
|
-
9. Omit a section that has nothing to say.
|
|
119
|
-
10. If a bullet needs two sentences, it is two bullets.
|
|
49
|
+
| Need | File |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| Writing an entry | `writing.md` |
|
|
52
|
+
| SPEC, ADR, DISCUSSION shape | `instructions/spec.md`, `adr.md`, `discussion.md` |
|
|
53
|
+
| Schema and IDs | `instructions/entries.md` |
|
|
54
|
+
| Reconciliation | `instructions/reconciliation.md` |
|
|
55
|
+
| Bootstrap | `instructions/bootstrap.md` |
|
|
120
56
|
|
|
121
|
-
|
|
57
|
+
## Rules that apply everywhere
|
|
122
58
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
| Need | Instruction |
|
|
128
|
-
| ---------------- | -------------------------------- |
|
|
129
|
-
| Bootstrap | `instructions/bootstrap.md` |
|
|
130
|
-
| SPEC | `instructions/spec.md` |
|
|
131
|
-
| ADR | `instructions/adr.md` |
|
|
132
|
-
| DISCUSSION | `instructions/discussion.md` |
|
|
133
|
-
| FLOW | `instructions/flow.md` |
|
|
134
|
-
| Reconciliation | `instructions/reconciliation.md` |
|
|
135
|
-
| Schema / entries | `instructions/entries.md` |
|
|
136
|
-
|
|
137
|
-
## General Rules
|
|
138
|
-
|
|
139
|
-
- Do not invent requirements.
|
|
140
|
-
- Do not create artifacts for completeness.
|
|
141
|
-
- Do not duplicate existing knowledge.
|
|
142
|
-
- Do not load unrelated context.
|
|
143
|
-
- Do not rewrite accurate artifacts.
|
|
144
|
-
- Do not record transient implementation details.
|
|
145
|
-
- Write every entry body in Entry Style.
|
|
146
|
-
- A rule that can be checked names the command that checks it; a rule that cannot says it is judgement.
|
|
59
|
+
- Do not invent requirements, create artifacts for completeness, or duplicate existing knowledge.
|
|
60
|
+
- Do not load unrelated context, rewrite accurate artifacts, or record transient details.
|
|
61
|
+
- A rule that can be checked names the command; one that cannot says it is judgement.
|
|
147
62
|
- Write a fact where it is read, and nowhere else.
|
|
148
63
|
- Prefer automatic, minimal, reversible actions.
|
|
149
64
|
- When intent cannot be determined safely, use `DISCUSSION`.
|
|
@@ -9,14 +9,15 @@
|
|
|
9
9
|
| DISCUSSION | `discussions/` | Open questions |
|
|
10
10
|
| INDEX | `README.md` | Route table |
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Work in progress is not routed here. sddio stores knowledge, not plans; a rollout belongs to
|
|
13
|
+
`flow-trail` or to the board the team already reads — see `ADR-011`.
|
|
13
14
|
|
|
14
15
|
## Lookup
|
|
15
16
|
|
|
16
17
|
- SPEC → `spec/`
|
|
17
18
|
- ADR → `adr/`
|
|
18
19
|
- DISCUSSION → `discussions/`
|
|
19
|
-
- Unknown area → `
|
|
20
|
+
- Unknown area → `sddio_docs/README.md`
|
|
20
21
|
|
|
21
22
|
## ID Routing
|
|
22
23
|
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Writing
|
|
2
|
+
|
|
3
|
+
Load this when an entry is about to be created or changed. Everything else is in
|
|
4
|
+
`instructions.md`, and reading it twice a session buys nothing.
|
|
5
|
+
|
|
6
|
+
## Admission
|
|
7
|
+
|
|
8
|
+
An entry is written only for a fact that reading the implementation cannot give you.
|
|
9
|
+
|
|
10
|
+
- Answer one line in the entry: `- Not in the code: <why the repository does not say this>`.
|
|
11
|
+
- If that line cannot be written, there is no entry. Not a shorter one — none.
|
|
12
|
+
- A fact the code or a shipped instruction already states is a citation: point at it with `refs`.
|
|
13
|
+
- A fact that can be regenerated by reading one file is not knowledge; it is a second copy that drifts.
|
|
14
|
+
- History is admissible: what was tried, what failed, who asked, and by when.
|
|
15
|
+
|
|
16
|
+
## Artifact roles
|
|
17
|
+
|
|
18
|
+
- `SPEC` — confirmed requirements. A command could falsify them.
|
|
19
|
+
- `ADR` — important technical decisions, the option that lost, and what each cost.
|
|
20
|
+
- `DISCUSSION` — unresolved knowledge; promoted into `SPEC` or `ADR`, then deleted.
|
|
21
|
+
|
|
22
|
+
Keep these roles distinct. Requirement or decision is settled by falsifiability: if a command could
|
|
23
|
+
fail, it is a `SPEC`; if only a person can be told why, it is an `ADR`.
|
|
24
|
+
|
|
25
|
+
## Classification
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
Requirement → SPEC
|
|
29
|
+
Decision → ADR
|
|
30
|
+
Uncertainty → DISCUSSION
|
|
31
|
+
Transient → nothing
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If several apply, create only the artifacts that are necessary.
|
|
35
|
+
|
|
36
|
+
## Entry style
|
|
37
|
+
|
|
38
|
+
1. One idea per line.
|
|
39
|
+
2. Bullets over paragraphs.
|
|
40
|
+
3. Keep lines under ~100 characters.
|
|
41
|
+
4. Facts only — no background, motivation, or history.
|
|
42
|
+
5. No filler: "clearly", "simply", "note that", "it is important".
|
|
43
|
+
6. Do not restate the title in the first bullet.
|
|
44
|
+
7. Reference other artifacts by ID; never repeat their content.
|
|
45
|
+
8. One level of nesting at most.
|
|
46
|
+
9. Omit a section that has nothing to say.
|
|
47
|
+
10. If a bullet needs two sentences, it is two bullets.
|
|
48
|
+
|
|
49
|
+
Shape test: every line is readable and actionable on its own.
|
|
50
|
+
|
|
51
|
+
## Detailed instructions
|
|
52
|
+
|
|
53
|
+
| Need | File |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| SPEC | `instructions/spec.md` |
|
|
56
|
+
| ADR | `instructions/adr.md` |
|
|
57
|
+
| DISCUSSION | `instructions/discussion.md` |
|
|
58
|
+
| Schema and IDs | `instructions/entries.md` |
|
|
59
|
+
| Reconciliation | `instructions/reconciliation.md` |
|
|
60
|
+
|
|
61
|
+
## General rules
|
|
62
|
+
|
|
63
|
+
- Do not invent requirements.
|
|
64
|
+
- Do not create artifacts for completeness.
|
|
65
|
+
- Do not duplicate existing knowledge.
|
|
66
|
+
- Do not rewrite accurate artifacts.
|
|
67
|
+
- Do not record transient implementation details.
|
|
68
|
+
- Write every entry body in Entry style.
|
|
69
|
+
- A rule that can be checked names the command that checks it; a rule that cannot says it is judgement.
|
|
70
|
+
- Write a fact where it is read, and nowhere else.
|
|
71
|
+
- Prefer automatic, minimal, reversible actions.
|
|
72
|
+
- When intent cannot be determined safely, use `DISCUSSION`.
|
|
73
|
+
|
|
74
|
+
## Restraint
|
|
75
|
+
|
|
76
|
+
- Do the least necessary.
|
|
77
|
+
- Add structure only when it provides clear value.
|
|
78
|
+
- Prefer the smaller solution when multiple solutions work.
|
|
79
|
+
- A rule is removed when it is measured as unfollowed, not when it feels unfollowed.
|
|
80
|
+
- Apply the last rule to the last three reconciled ranges; measure with the `grep` the rule names.
|
package/dist/skill.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The sddio agent skill (ADR-008).
|
|
3
|
-
*
|
|
4
|
-
* The skill ships inside the package as `.sddio/skill/SKILL.md`, generated at
|
|
5
|
-
* build time with the rest of the context layer. The CLI only reads it: nothing
|
|
6
|
-
* is written into an agent's skills directory, because that would mean editing
|
|
7
|
-
* files outside the repository with no reliable way to undo it.
|
|
8
|
-
*
|
|
9
|
-
* It is a router. It names paths and invariants, never the rules themselves, so
|
|
10
|
-
* it keeps working when `.sddio/` is upgraded underneath it.
|
|
11
|
-
*/
|
|
12
|
-
import { readFile } from 'node:fs/promises';
|
|
13
|
-
import { join } from 'node:path';
|
|
14
|
-
import { contextTemplateRoot } from './paths.js';
|
|
15
|
-
export const skillPath = join(contextTemplateRoot, 'skill', 'SKILL.md');
|
|
16
|
-
export async function readSkill() {
|
|
17
|
-
return readFile(skillPath, 'utf8');
|
|
18
|
-
}
|