@ericrisco/rsc 1.0.26 → 1.0.27

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/manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.26",
2
+ "version": "1.0.27",
3
3
  "counts": {
4
4
  "skills": 264
5
5
  },
@@ -4557,7 +4557,7 @@
4557
4557
  },
4558
4558
  {
4559
4559
  "id": "specify",
4560
- "description": "Use when a feature, change, or product idea is still fuzzy and must become an approved WHAT/WHY spec before any planning or code — the brainstorming front door of SDD. Turns a one-line intent into problem, goals, users, scope, behaviour and acceptance criteria, via one-question-at-a-time dialogue and 2-3 approaches with a recommendation, carrying zero implementation detail. Fires whenever someone jumps to HOW before WHAT is agreed, in any language. NOT the technical plan (that is `plan`), NOT the de-risking ambiguity sweep (that is `clarify`), NOT project-wide principles (that is `constitution`).",
4560
+ "description": "Use when a feature, change, or product idea is still fuzzy and must become an approved WHAT/WHY spec before any planning or code — the brainstorming front door of SDD. Turns a one-line intent into problem, goals, users, scope, behaviour and acceptance criteria, via frontier-round dialogue and 2-3 approaches with a recommendation, carrying zero implementation detail. Fires whenever someone jumps to HOW before WHAT is agreed, in any language. NOT the technical plan (that is `plan`), NOT the de-risking ambiguity sweep (that is `clarify`), NOT project-wide principles (that is `constitution`).",
4561
4561
  "tags": [
4562
4562
  "sdd",
4563
4563
  "spec",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ericrisco/rsc",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "Eric Risco's agent-skills catalog as a granular, self-recommending CLI installer.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,6 +17,7 @@
17
17
  "drift:check": "node scripts/drift-check.js",
18
18
  "drift:knowledge": "node scripts/drift-check.js --knowledge",
19
19
  "knowledge:doctor": "node scripts/knowledge-doctor.js",
20
+ "spec:gate": "node scripts/spec-gate.js",
20
21
  "routing:audit": "node scripts/routing-audit.js",
21
22
  "test": "node --test",
22
23
  "coverage": "c8 --reporter=text node --test",
@@ -3,14 +3,15 @@ import { join, dirname } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import Ajv from 'ajv';
5
5
  import { parseFrontmatter } from './lib/frontmatter.js';
6
+ import { fenceBalance } from './lib/skill-lint.js';
6
7
 
7
8
  const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
8
9
  const SKILLS = join(ROOT, 'skills');
9
10
 
10
- function skillDirs() {
11
- return readdirSync(SKILLS).filter((d) => {
11
+ function skillDirs(base = SKILLS) {
12
+ return readdirSync(base).filter((d) => {
12
13
  try {
13
- return statSync(join(SKILLS, d)).isDirectory() && statSync(join(SKILLS, d, 'SKILL.md')).isFile();
14
+ return statSync(join(base, d)).isDirectory() && statSync(join(base, d, 'SKILL.md')).isFile();
14
15
  } catch {
15
16
  return false;
16
17
  }
@@ -47,6 +48,20 @@ export function validateFrontmatter() {
47
48
  return errors;
48
49
  }
49
50
 
51
+ // A skill body whose code-block delimiters do not pair renders half its content as one code block,
52
+ // and every other gate stays green while it happens. Deterministic defect, deterministic check —
53
+ // and it lives here so `prepublishOnly` can never ship one.
54
+ export function validateBodies(base = SKILLS) {
55
+ const errors = [];
56
+ for (const id of skillDirs(base)) {
57
+ const r = fenceBalance(readFileSync(join(base, id, 'SKILL.md'), 'utf8'));
58
+ if (!r.balanced) {
59
+ errors.push(`${id}: unbalanced code-block delimiter opened at line ${r.opened} (${r.fences} found)`);
60
+ }
61
+ }
62
+ return errors;
63
+ }
64
+
50
65
  // A skill's `description` is in context on every turn it is installed, invoked or not, so the
51
66
  // catalog's total description weight is the one number that scales with the catalog itself.
52
67
  // The hard failure stays at the schema limit; this reports the soft ceiling the rubric asks for,
@@ -67,9 +82,10 @@ function main() {
67
82
  const arg = process.argv[2];
68
83
  const out = join(ROOT, 'manifest.json');
69
84
  if (arg === '--validate') {
70
- const errs = validateFrontmatter();
85
+ const errs = [...validateFrontmatter(), ...validateBodies()];
71
86
  if (errs.length) { console.error(errs.join('\n')); process.exit(1); }
72
87
  console.log('frontmatter OK');
88
+ console.log('skill bodies OK (code-block delimiters balanced)');
73
89
  const w = descriptionWeight();
74
90
  console.log(
75
91
  `description weight: ${(w.total / 1024).toFixed(1)} KB across ${w.count} skills `
@@ -0,0 +1,29 @@
1
+ // Structural lint of a skill body. Pure: give it the text, get a verdict.
2
+ //
3
+ // Scope is deliberately one defect class. A stray closing delimiter inverts every block boundary
4
+ // after it, so a skill can render half its body as one code block while every other gate stays
5
+ // green: the frontmatter validates, the description fits, the prose reads fine in the source. It is
6
+ // a purely deterministic defect, so it belongs to a binary, not to a reader's attention.
7
+
8
+ const FENCE = /^(?:```|~~~)/;
9
+
10
+ /**
11
+ * @param {string} body raw skill markdown
12
+ * @returns {{balanced: boolean, fences: number, opened: number|null}}
13
+ * `fences` counts column-0 delimiters; `opened` is the 1-indexed line of the unpaired one.
14
+ */
15
+ export function fenceBalance(body) {
16
+ const lines = String(body ?? '').split('\n');
17
+ let open = null; // line number of the delimiter that opened the current block
18
+ let fences = 0;
19
+
20
+ for (let i = 0; i < lines.length; i += 1) {
21
+ // Only a column-0 delimiter is a block boundary. Indented ones are content: a fenced sample
22
+ // inside a fenced block. Counting those would flag correct documents.
23
+ if (!FENCE.test(lines[i])) continue;
24
+ fences += 1;
25
+ open = open === null ? i + 1 : null;
26
+ }
27
+
28
+ return { balanced: open === null, fences, opened: open };
29
+ }
@@ -0,0 +1,122 @@
1
+ // The exit gate of the `specify` phase, as a binary instead of a feeling.
2
+ //
3
+ // "Stop when the WHAT and WHY are complete enough to plan against" cannot tell done from not-done,
4
+ // so the phase closed whenever the agent felt closed — with the write/review/approve steps visible
5
+ // the whole time, pulling attention toward being finished. This checks the artifact instead: every
6
+ // template section carries content or an explicit open point.
7
+ //
8
+ // What it does NOT check is returned in `unchecked`, on purpose. Detecting an unmarked assumption is
9
+ // the problem `specify` exists to solve, not something a parser can do, and a gate that implies
10
+ // otherwise is worse than one that admits its edge.
11
+
12
+ // The four states a point can be in. Order is the table's order in the skill body.
13
+ export const OPEN_POINT_TYPES = [
14
+ 'pregunta abierta', // formulable now, unanswered → clarify asks it
15
+ 'suposición tomada', // we decided, with the basis written → clarify validates it
16
+ 'decisión diferida', // sharp, out of this cycle on purpose → clarify leaves it
17
+ 'área no formulable', // known to be coming, not yet sharp → clarify notes it
18
+ ];
19
+
20
+ // The corpus is Spanish, the template is English, and both carry drifting parentheticals
21
+ // ("Objetivos (resultado)", "Criterios de aceptación (binarios)"). Matching literal strings would
22
+ // be useless, so each family is a set of normalised prefixes.
23
+ const FAMILIES = {
24
+ problem: ['problema & por que', 'problema y por que', 'problem & why'],
25
+ goals: ['objetivos', 'goals'],
26
+ nongoals: ['no-objetivos', 'no objetivos', 'non-goals'],
27
+ users: ['usuarios & contexto', 'usuarios y contexto', 'users & context'],
28
+ behaviour: ['comportamiento', 'behaviour', 'behavior'],
29
+ acceptance: ['criterios de aceptacion', 'acceptance criteria'],
30
+ open: ['puntos a clarificar', 'puntos de clarify', 'puntos que siguen abiertos', 'points to clarify'],
31
+ };
32
+
33
+ const UNCHECKED = [
34
+ 'que ninguna sección contenga una suposición sin marcar (no es detectable por máquina; es el juicio que la fase existe para ejercer)',
35
+ 'que el contenido de cada sección sea correcto, y no sólo presente',
36
+ 'que los criterios de aceptación sean de verdad binarios',
37
+ ];
38
+
39
+ function fold(s) {
40
+ return s
41
+ .normalize('NFD')
42
+ .replace(/[̀-ͯ]/g, '')
43
+ .toLowerCase()
44
+ .trim();
45
+ }
46
+
47
+ function familyOf(heading) {
48
+ const h = fold(heading);
49
+ for (const [family, prefixes] of Object.entries(FAMILIES)) {
50
+ if (prefixes.some((p) => h.startsWith(p))) return family;
51
+ }
52
+ return null;
53
+ }
54
+
55
+ // A heading with nothing under it is not a filled section. Neither is one holding only the
56
+ // template's own italic/angle-bracket guidance, which is what a hurried pass leaves behind.
57
+ function isSubstantive(line) {
58
+ const t = line.trim();
59
+ if (!t) return false;
60
+ if (/^<.*>$/.test(t)) return false; // <guidance from the template>
61
+ if (/^\*[^*].*\*$/.test(t) && t.length < 200) return false; // *italic guidance*
62
+ if (/^(-|\*)\s*$/.test(t)) return false; // an empty bullet
63
+ return true;
64
+ }
65
+
66
+ function parseOpenPoints(lines) {
67
+ const points = [];
68
+ for (const line of lines) {
69
+ const m = line.match(/^\s*[-*]\s+(?:\[[ x]\]\s*)?(.*)$/);
70
+ if (!m || !m[1].trim()) continue;
71
+ const body = m[1];
72
+ const declared = OPEN_POINT_TYPES.find((t) => {
73
+ const re = new RegExp(`^\\*\\*\\s*${t.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*\\*\\*`, 'i');
74
+ return re.test(fold(body)) || re.test(body);
75
+ });
76
+ points.push({
77
+ type: declared || OPEN_POINT_TYPES[0], // the costliest default: treat it as a real question
78
+ typed: Boolean(declared),
79
+ text: body.trim(),
80
+ });
81
+ }
82
+ return points;
83
+ }
84
+
85
+ /**
86
+ * @param {string} markdown a written spec file
87
+ * @returns {{ok: boolean, missing: string[], empty: string[],
88
+ * openPoints: Array<{type: string, typed: boolean, text: string}>,
89
+ * untyped: string[], unchecked: string[]}}
90
+ */
91
+ export function specCompleteness(markdown) {
92
+ const lines = String(markdown ?? '').split('\n');
93
+ const sections = new Map(); // family -> body lines
94
+
95
+ let current = null;
96
+ for (const line of lines) {
97
+ const h = line.match(/^##\s+(.*)$/);
98
+ if (h) {
99
+ const fam = familyOf(h[1]);
100
+ current = fam;
101
+ if (fam && !sections.has(fam)) sections.set(fam, []);
102
+ continue;
103
+ }
104
+ if (current && sections.has(current)) sections.get(current).push(line);
105
+ }
106
+
107
+ const families = Object.keys(FAMILIES);
108
+ const missing = families.filter((f) => !sections.has(f));
109
+ const empty = families.filter((f) => sections.has(f) && !sections.get(f).some(isSubstantive));
110
+
111
+ const openPoints = sections.has('open') ? parseOpenPoints(sections.get('open')) : [];
112
+ const untyped = openPoints.filter((p) => !p.typed).map((p) => p.text);
113
+
114
+ return {
115
+ ok: missing.length === 0 && empty.length === 0,
116
+ missing,
117
+ empty,
118
+ openPoints,
119
+ untyped,
120
+ unchecked: UNCHECKED,
121
+ };
122
+ }
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ // Runs the `specify` exit gate over written specs. Report-only: it never edits a spec.
3
+ //
4
+ // Not wired into `prepublishOnly`, and that is deliberate: specs live under 02-DOCS, which is never
5
+ // tracked (principle 9), so a publish gate depending on them would fail in any clean clone. This is
6
+ // the phase's own instrument, and the author's.
7
+ import { readFileSync, readdirSync } from 'node:fs';
8
+ import { join, dirname, basename } from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
10
+ import { specCompleteness } from './lib/spec-gate.js';
11
+
12
+ const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
13
+ const DEFAULT_DIR = join(ROOT, '02-DOCS', 'wiki', 'sdd', 'specs');
14
+
15
+ function defaultTargets() {
16
+ try {
17
+ return readdirSync(DEFAULT_DIR)
18
+ .filter((f) => f.endsWith('.md') && !f.endsWith('.plan.md'))
19
+ .map((f) => join(DEFAULT_DIR, f));
20
+ } catch {
21
+ return [];
22
+ }
23
+ }
24
+
25
+ function main() {
26
+ const args = process.argv.slice(2);
27
+ const targets = args.length ? args : defaultTargets();
28
+ if (!targets.length) {
29
+ console.log('no specs found — pass a path, or write one to 02-DOCS/wiki/sdd/specs/');
30
+ return;
31
+ }
32
+
33
+ let failed = 0;
34
+ for (const path of targets) {
35
+ const r = specCompleteness(readFileSync(path, 'utf8'));
36
+ const name = basename(path);
37
+ if (r.ok) {
38
+ const typed = r.openPoints.length - r.untyped.length;
39
+ console.log(`PASS ${name} — ${r.openPoints.length} open point(s), ${typed} typed`);
40
+ if (r.untyped.length) {
41
+ console.log(` untyped (treated as open questions): ${r.untyped.length}`);
42
+ }
43
+ } else {
44
+ failed += 1;
45
+ console.log(`FAIL ${name}`);
46
+ if (r.missing.length) console.log(` missing section(s): ${r.missing.join(', ')}`);
47
+ if (r.empty.length) console.log(` section(s) with no content: ${r.empty.join(', ')}`);
48
+ }
49
+ }
50
+
51
+ // A green here is narrower than the rule it enforces, so it says so every run rather than
52
+ // letting the reader assume the gate covered more than it did.
53
+ console.log(`\n${targets.length - failed}/${targets.length} pass. Not checked by this gate:`);
54
+ for (const u of specCompleteness('').unchecked) console.log(` - ${u}`);
55
+ if (failed) process.exit(1);
56
+ }
57
+
58
+ main();
@@ -28,12 +28,36 @@ This is the fourth phase of the rsc SDD chain (`constitution` → `specify` →
28
28
 
29
29
  Clarify never works blind. Before asking a single question, load three things:
30
30
 
31
- 1. **The spec.** Read the target spec under `02-DOCS/wiki/sdd/specs/<slug>.md` end to end. If the path wasn't given, find the most recently touched spec or ask which one.
31
+ 1. **The spec.** Read the target spec under `02-DOCS/wiki/sdd/specs/<slug>.md` end to end. If the path wasn't given, find the most recently touched spec or ask which one. Its *Points to clarify* is a **typed** handoff, not a question list — read the types before you plan a single question (below).
32
32
  2. **The constitution.** Read `02-DOCS/wiki/sdd/constitution.md` if it exists. Its principles (stack canon, quality bars, conventions) resolve a surprising number of "ambiguities" without bothering the user — if the constitution already fixes the auth method or the data region, that's answered, not open.
33
33
  3. **The harness profile.** `02-DOCS/wiki/harness/user-profile.md`, for the dial above.
34
34
 
35
35
  Citing what you read ("checked the constitution — auth is already fixed to OAuth, so that's not an open question") shows your work and prevents re-litigating settled decisions.
36
36
 
37
+ ## The typed handoff — what `specify` already decided
38
+
39
+ *Points to clarify* holds four different objects, and each one gets a different action from you.
40
+ Treating all four as questions is how clarify re-asks what was already decided and disturbs what was
41
+ deliberately deferred:
42
+
43
+ | Type in the spec | What it means | Your action |
44
+ | --- | --- | --- |
45
+ | **pregunta abierta** | Formulable, unanswered | Ask it — this is your queue |
46
+ | **suposición tomada** | `specify` decided it; the basis is written | **Validate**, don't re-ask: state the assumption and its basis back, and ask only whether it still holds |
47
+ | **decisión diferida** | Sharp, out of this cycle on purpose | Leave it. Do not reopen scope the author closed |
48
+ | **área no formulable** | Known to be coming, not yet phrasable | Note it. If your pass sharpens it into a real question, it graduates — say that it did |
49
+
50
+ **Declare what you did with each entry.** Close the pass with one line per point: asked, validated
51
+ (held / broke), left deferred, or graduated. An entry you silently dropped is the gap that comes back
52
+ at implementation time.
53
+
54
+ **An untyped entry** (an older spec, or a hurried one) is read as **pregunta abierta** — the
55
+ costliest reading, so nothing gets skipped by accident. Type it as you go, so the spec improves on
56
+ the way through.
57
+
58
+ Sharpness, not difficulty, is what separates a question from an unformulable area: *can you state it
59
+ precisely now?* Not *can you answer it?*
60
+
37
61
  ## The ambiguity taxonomy — where specs hide their gaps
38
62
 
39
63
  Scan the spec against these categories. Most real gaps fall into one of them; walking the list is how you find the ones the author didn't think to write down.
@@ -111,7 +135,7 @@ After baking back, the spec line becomes a bounded, testable behavior with accep
111
135
 
112
136
  ## Exit gate
113
137
 
114
- The gate is passed when the spec, constitution and profile were all read (settled questions cited, not re-asked); all ten taxonomy categories were considered; only the build-changing gaps were put to the user, as dial-sized decisions with recommendations; every answer is baked into the spec body with observable acceptance criteria, logged under `## Clarifications` and bounded under `## Out of scope`; and the final re-read opened no new gap.
138
+ The gate is passed when the spec, constitution and profile were all read (settled questions cited, not re-asked); **every typed point in the handoff has its declared outcome** (asked / validated / left deferred / graduated), with nothing silently dropped; all ten taxonomy categories were considered; only the build-changing gaps were put to the user, as dial-sized decisions with recommendations; every answer is baked into the spec body with observable acceptance criteria, logged under `## Clarifications` and bounded under `## Out of scope`; and the final re-read opened no new gap.
115
139
 
116
140
  ## Result envelope
117
141
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: specify
3
- description: "Use when a feature, change, or product idea is still fuzzy and must become an approved WHAT/WHY spec before any planning or code — the brainstorming front door of SDD. Turns a one-line intent into problem, goals, users, scope, behaviour and acceptance criteria, via one-question-at-a-time dialogue and 2-3 approaches with a recommendation, carrying zero implementation detail. Fires whenever someone jumps to HOW before WHAT is agreed, in any language. NOT the technical plan (that is `plan`), NOT the de-risking ambiguity sweep (that is `clarify`), NOT project-wide principles (that is `constitution`)."
3
+ description: "Use when a feature, change, or product idea is still fuzzy and must become an approved WHAT/WHY spec before any planning or code — the brainstorming front door of SDD. Turns a one-line intent into problem, goals, users, scope, behaviour and acceptance criteria, via frontier-round dialogue and 2-3 approaches with a recommendation, carrying zero implementation detail. Fires whenever someone jumps to HOW before WHAT is agreed, in any language. NOT the technical plan (that is `plan`), NOT the de-risking ambiguity sweep (that is `clarify`), NOT project-wide principles (that is `constitution`)."
4
4
  tags: [sdd, spec, requirements]
5
5
  recommends: [clarify, plan]
6
6
  profiles: [core, full]
@@ -29,9 +29,11 @@ A **yes engages autopilot** (`../sdd/SKILL.md`): you still write the spec and ev
29
29
 
30
30
  ## The one rule that defines this skill
31
31
 
32
- **No implementation leaks.** The moment the spec names a framework, a table schema, a library, an endpoint shape, a file path, or an algorithm, it has stopped being a spec. Those decisions belong to `plan` and the stack skills. Specify describes the *observable behaviour and the reason for it*; the system that delivers it is deliberately left open.
32
+ A spec is a **contract**: what the system will observably do, and why that matters. Every line either belongs in the contract or belongs to how the contract gets honoured — and the second kind is `plan`'s, not yours. Framework, table schema, library, endpoint shape, file path, algorithm: all of them are how, so the moment one appears the document has stopped being a contract.
33
33
 
34
- If you cannot describe a requirement without naming the technology, you have found a real question — record it as a point to clarify, do not guess the answer.
34
+ One question settles every judgement call in this skill: **is this a clause of the contract, or a detail of how it gets met?**
35
+
36
+ If you cannot state a requirement without naming the technology, that is a real open question — record it as a typed point to clarify, do not guess the answer.
35
37
 
36
38
  ## Model tier — `balanced` (opt-in routing)
37
39
 
@@ -41,23 +43,25 @@ This phase's default model tier is **`balanced`** — it drafts the what/why spe
41
43
 
42
44
  Before asking anything, read `02-DOCS/wiki/harness/user-profile.md` for the technical level and accompaniment level, and adapt:
43
45
 
44
- - **L0 "cavernícola"** — infer aggressively from the intent and any existing wiki/constitution. Ask only the questions whose answer would change the spec's scope. Draft, show, move on.
46
+ - **L0 "cavernícola"** — infer aggressively from the intent and any existing wiki/constitution. Ask only the questions whose answer would change the contract. Draft, show, move on.
45
47
  - **L1 "breve"** — one line of *why* per question; ask the few that genuinely matter.
46
48
  - **L2 "explica decisiones"** — justify each requirement as you record it; surface the trade-offs you inferred.
47
- - **L3 "acompañamiento total"** — explain what a spec is and is not, walk every section, ask freely (still one question at a time), confirm each answer before recording it. Ideal for non-technical users.
49
+ - **L3 "acompañamiento total"** — explain what a spec is and is not, walk every section, ask freely (still one round per frontier, never crossing a dependency), confirm each answer before recording it. Ideal for non-technical users.
48
50
 
49
51
  If no profile exists, default to non-technical framing and keep questions plain. Never assume fluency.
50
52
 
51
- ## Questioning discipline — one at a time, only where you can't infer
53
+ ## Questioning discipline — ask the frontier, never cross a dependency
52
54
 
53
- The failure mode of specs is the wall of twenty questions. Avoid it:
55
+ The failure mode of specs is the wall of twenty questions. The cure is not one question per turn: that spends a turn of the user's time per question even when the questions do not touch each other. The cure is the **frontier**.
54
56
 
55
57
  1. **Infer first.** Read the `constitution` (`02-DOCS/wiki/sdd/constitution.md`), the existing wiki, and sibling specs. Fill every section you reasonably can from what already exists.
56
- 2. **Ask only the gaps that change the spec.** A question earns its place only if a different answer would change scope, a goal, a user, or an acceptance criterion. Cosmetic gaps become *points to clarify*, not questions.
57
- 3. **One focused question per turn.** Ask, wait, record, then ask the next. Never batch. Phrase in the user's technical register.
58
- 4. **When inference and asking both fail, mark it.** Anything you cannot resolve in this pass becomes an explicit entry in *Points to clarify* — that list is the handoff contract to the `clarify` phase, not a defect.
58
+ 2. **Ask only the gaps that change the contract.** A gap earns a question only if a different answer would move scope, a goal, a user, or an acceptance criterion. Cosmetic gaps become typed *points to clarify*, not questions.
59
+ 3. **Ask the whole frontier in one round.** The frontier is every remaining gap whose prerequisites are already settled — the questions you can ask *now* without guessing at answers you have not heard yet. Number them, give each your recommended answer, then wait. Where the harness offers a native question selector, use it; where it does not, emit the same round as numbered text.
60
+ 4. **Never cross a dependency.** A gap whose answer depends on another question open in *this* round belongs to a later round. Recompute the frontier after every set of answers: settled decisions push it outward and unblock what waited on them. If an answer redefines a question you already emitted in the same round, discard that question out loud and re-ask it next round rather than using an answer given under a premise that just moved.
61
+ 5. **Facts are your job; decisions are the user's.** When a frontier question needs a fact from the environment, go find it — and do not block on it. A running search is an unsettled prerequisite, so only the questions downstream of it wait; ask the rest of the frontier now.
62
+ 6. **When inference and asking both fail, type it.** Anything unresolved becomes a typed entry in *Points to clarify* — the handoff contract to `clarify`, not a defect.
59
63
 
60
- Stop asking when the WHAT and WHY are complete enough to plan against. Remaining unknowns live in *Points to clarify*; you do not need every answer before writing the file.
64
+ A frontier of one is one question, and needs no apology. A frontier of zero is no question at all: never invent one to look diligent.
61
65
 
62
66
  ## What a good spec contains
63
67
 
@@ -71,7 +75,7 @@ Write these sections into `02-DOCS/wiki/sdd/specs/<slug>.md` using `references/s
71
75
  | Users & context | Who acts, their context, what they're trying to achieve | An imagined user no one asked for |
72
76
  | Behaviour | What the system does, in observable terms, incl. main + edge + error paths | A verb that's actually a HOW ("queries", "caches") |
73
77
  | Acceptance criteria | Testable, binary checks that say "done" | Vague critera ("works well", "is fast") |
74
- | Points to clarify | Open questions, assumptions made, decisions deferred | Pretending there are none |
78
+ | Points to clarify | The typed handoff to `clarify` — see the four types below | An untyped list, or pretending there are none |
75
79
 
76
80
  ### Acceptance criteria carry the weight
77
81
 
@@ -85,6 +89,33 @@ Then they see an empty-cart message and the "pay" button is disabled
85
89
 
86
90
  A criterion that needs a human to "decide if it's good enough" is not done yet — sharpen it or move the soft part to *Points to clarify*.
87
91
 
92
+ ### Points to clarify carry a type
93
+
94
+ *Points to clarify* is the handoff to `clarify`, and it holds four different objects that need four
95
+ different actions. An untyped list makes `clarify` treat all of them as questions, so it re-asks what
96
+ you already decided and touches what you deliberately deferred. Type every entry:
97
+
98
+ | Type | What it is | What `clarify` does with it |
99
+ | --- | --- | --- |
100
+ | **pregunta abierta** | Formulable with precision right now, unanswered | Asks it |
101
+ | **suposición tomada** | You decided it; the basis is written down | Validates it — does it still hold? |
102
+ | **decisión diferida** | Sharp, out of this cycle on purpose | Leaves it alone |
103
+ | **área no formulable** | Known to be coming, not yet sharp enough to phrase | Notes it; it graduates when it sharpens |
104
+
105
+ The test that separates the last two from a question is **sharpness, not difficulty**: *can you state
106
+ the question precisely now?* — not *can you answer it?* Sharp → **pregunta abierta**. Not sharp →
107
+ **área no formulable**. Beyond what this change is for → `Non-goals`, where it never graduates.
108
+
109
+ Write the type in bold at the head of the entry, and give a `suposición tomada` its basis:
110
+
111
+ ```text
112
+ - **suposición tomada** — el enlace caduca en minutos, no en horas. *Base:* el patrón de los
113
+ proveedores que ya usamos. *Riesgo:* si el soporte pide horas, el criterio de aceptación cambia.
114
+ ```
115
+
116
+ An entry with no type is read as **pregunta abierta**, the costliest of the four. The default never
117
+ saves you work.
118
+
88
119
  ## The pass, end to end
89
120
 
90
121
  Run these in order. It is a collaborative dialogue, not a form you fill in silence — and **you do not skip to a design dump.** Track the steps with a todo list so none is dropped.
@@ -94,23 +125,40 @@ Run these in order. It is a collaborative dialogue, not a form you fill in silen
94
125
  2. SCOPE check → if the request is several independent subsystems, DECOMPOSE into sub-specs first,
95
126
  then brainstorm the FIRST one; each gets its own spec → plan → build cycle
96
127
  3. RESTATE in one sentence→ confirm you understood the intent before anything else
97
- 4. ASK, one at a time → only the gaps that change scope; multiple-choice when you can; wait, record, repeat
128
+ 4. ASK the frontier → only gaps that change the contract; whole frontier per round, numbered, each
129
+ with your recommendation; never cross a dependency; wait, record, recompute
98
130
  5. PROPOSE 2-3 approaches → distinct directions with honest trade-offs; lead with your recommendation and why
99
131
  6. PRESENT the design → section by section (problem, users, behaviour, acceptance), scaled to complexity;
100
132
  after EACH section ask "does this look right?" and adjust before moving on
101
133
  7. WRITE the spec → 02-DOCS/wiki/sdd/specs/<slug>.md (WHAT/WHY), index it in 02-DOCS/wiki/index.md
102
134
  (the Knowledge map; root CLAUDE.md keeps only a short pointer), commit if a repo
103
- 8. SELF-REVIEW → scan for TODO/placeholder, contradictions, ambiguity, scope creep; fix inline.
104
- On L2/L3 or a high-risk spec, also dispatch a FRESH-EYES review (below)
135
+ 8. SELF-REVIEW → run the EXIT GATE (below) until green; scan for contradictions, ambiguity,
136
+ scope creep; fix inline. On L2/L3 or high risk, add a FRESH-EYES review
105
137
  9. USER APPROVES → ask them to read the written spec and confirm; loop on changes until they approve
106
138
  10. HAND OFF → only now, result envelope → clarify/plan. NEVER to implement.
107
139
  ```
108
140
 
109
- **The gate is steps 5-9, and it is the point of this skill.** Implementation does not begin — not `plan`-to-code, not a stack skill, not "just a quick version" — until the user has approved the design at step 9. This holds for **every** feature, including ones that feel too small to design; "too simple to spec" is exactly where unexamined assumptions cost the most. The only thing that skips the loop is a literal one-line, zero-risk change (a typo, a copy tweak) — name it as such and do it.
110
- ```
141
+ **Steps 5-9 are the gate**, stated once under *Detect the moment* above and not restated here: approval at step 9 is what unlocks implementation.
111
142
 
112
143
  `<slug>` is a short kebab-case name derived from the feature (e.g. `bulk-csv-import`, `magic-link-login`). If a spec with that slug exists, read it and update rather than overwrite.
113
144
 
145
+ ### Exit gate — checked, not felt
146
+
147
+ "Complete enough to plan against" cannot tell done from not-done, and the write/review/approve steps
148
+ are visible while you are still asking, pulling attention toward being finished. So the bound is a
149
+ property of the **file**, not of your confidence:
150
+
151
+ > Every template section carries content or an explicit typed open point, and no section holds an
152
+ > unmarked assumption.
153
+
154
+ Run `npm run spec:gate <path>` on the spec you just wrote (no path: the whole corpus). It reports the
155
+ missing and the empty sections by name, and it prints what it does **not** check — the unmarked
156
+ assumption is yours to catch, because no parser can. A red gate means the spec is not closed: name
157
+ the section that failed and fix it before step 9.
158
+
159
+ A gate that has never been seen fail is not known to work, so this one ships with the test that
160
+ watches it fail and pass (`tests/spec-gate.test.js`).
161
+
114
162
  ### Fresh-eyes spec review (step 8, scaled to the dial)
115
163
 
116
164
  The author's own context is blind to its own gaps — the same mind that wrote the spec self-reviews it
@@ -191,8 +239,12 @@ A returning user on a new device who does not remember a password.
191
239
  link can be requested.
192
240
 
193
241
  ## Points to clarify
194
- - Link validity window? (assumed: short, exact value deferred to clarify)
195
- - Rate-limit on requests per email? (deferred)
242
+ - **pregunta abierta** — ¿cuánto vale la ventana de validez del enlace?
243
+ - **suposición tomada** — la ventana es corta, en minutos. *Base:* el patrón de los proveedores que
244
+ ya usamos. *Riesgo:* si soporte pide horas, cambia el criterio de aceptación.
245
+ - **decisión diferida** — límite de peticiones por email; fuera de este ciclo.
246
+ - **área no formulable** — qué pasa con las cuentas compartidas; sospecho que hay una pregunta y
247
+ todavía no sé enunciarla.
196
248
  ```
197
249
 
198
250
  Note what is *absent*: no token format, no table, no email provider, no framework. Those are `plan`'s job.
@@ -226,17 +278,16 @@ The proposal is allowed to mention options and tradeoffs; the spec that follows
226
278
 
227
279
  ## Anti-patterns → STOP
228
280
 
281
+ Only failures with no positive statement elsewhere in this skill. The rules about the frontier, the
282
+ constitution, the 2-3 approaches, the gate, and answer-is-not-approval are stated positively above
283
+ (§Questioning discipline, §Detect the moment, the pass, §Approval is its own exchange) and are not
284
+ repeated here as prohibitions: naming a behaviour makes it more available, not less.
285
+
229
286
  | If you're about to… | Reality / Fix |
230
287
  | --- | --- |
231
288
  | Name a framework, table, endpoint, or library | That's HOW. Strip it; describe the behaviour instead, or log the open question. |
232
- | Dump 12 questions in one message | One focused question per turn. Infer the rest from the constitution and wiki. |
233
- | Ask a question you could answer from the constitution | Read it first. Only ask what genuinely changes the spec. |
234
289
  | Write "it should work well / be fast / be intuitive" | Not testable. Make it a binary Given/When/Then or move it to Points to clarify. |
235
- | Skip the whole loop because "this is too simple to design" | That's the rationalization that wastes the most work. Every feature gets the loop; only a literal one-line, zero-risk change skips. |
236
- | Present one approach as the answer | Offer 2-3 distinct directions with trade-offs and a recommendation; let the user choose before you write the spec. |
237
290
  | Hand to `plan`/`implement` before the user approved the written spec | The approval at step 9 is the gate. No design approved → nothing gets built. |
238
- | Treat the answer to your question as the approval of the spec | They answered the question, and the answer *changed* the spec. Fold it in, say what changed, show it, ask again. |
239
- | Write `status: aprobada` after a blanket "just run it" | That is autopilot. Record it as such — the record must not overstate the strongest gate in the chain. |
240
291
  | Skip non-goals because "it's obvious" | Unsaid scope becomes assumed scope. State what you are *not* doing. |
241
292
  | Resolve every ambiguity yourself to look finished | Inventing answers is worse than naming gaps. List them in Points to clarify. |
242
293
  | Start designing the solution because it's clearer | Stay on WHAT/WHY. The plan is a later, separate phase. |
@@ -287,7 +338,7 @@ If `clarify` surfaces answers, they get baked back into this same spec file. Onl
287
338
  - `../plan/SKILL.md` — turns the de-risked spec into a technical implementation plan (the HOW).
288
339
  - `../harness/SKILL.md` — the 02-DOCS wiki + accompaniment dial + decisions log this skill honors.
289
340
  - `references/spec-template.md` — the exact section template written to `02-DOCS/wiki/sdd/specs/<slug>.md`.
290
- - `references/eliciting-requirements.md` — inference checklist + the one-question-at-a-time elicitation patterns.
341
+ - `references/eliciting-requirements.md` — inference checklist + the frontier-round elicitation pattern.
291
342
 
292
343
  ## Orientación (siempre)
293
344
 
@@ -63,20 +63,20 @@ should_not_trigger:
63
63
  capability:
64
64
  - scenario: "A user says: 'I want to add magic-link (passwordless) login.' There is a constitution at 02-DOCS/wiki/sdd/constitution.md but no spec yet. Produce the spec."
65
65
  must_include:
66
- - "Reads the accompaniment level from 02-DOCS/wiki/harness/user-profile.md and the constitution first, inferring everything it can before asking, then asks only scope-changing questions ONE at a time (not a batch of ten)."
66
+ - "Reads the accompaniment level from 02-DOCS/wiki/harness/user-profile.md and the constitution first, inferring everything it can before asking, then asks only contract-changing gaps — the whole FRONTIER in one numbered round, each with its recommendation, and nothing whose answer depends on another question open in that same round."
67
67
  - "Stays strictly WHAT/WHY: no framework, token format, database table, endpoint shape, email provider, library, or file path appears in the spec — implementation-laden answers are flagged as points to clarify instead of guessed."
68
68
  - "Produces the spec sections: Problem & why, Goals, Non-goals / out of scope, Users & context, Behaviour (main + edge + error paths), Acceptance criteria, Points to clarify."
69
69
  - "Writes testable acceptance criteria in Given/When/Then form that verify could later check (e.g. expired-link refusal, unknown-email revealing nothing)."
70
70
  - "Writes the file to 02-DOCS/wiki/sdd/specs/<slug>.md (kebab-case slug), indexes it in the root CLAUDE.md Knowledge map under sdd/specs, and logs the spec creation to the canonical SDD decisions log at 02-DOCS/wiki/sdd/decisions.md."
71
- - "Lists honest Points to clarify (e.g. link validity window, rate-limiting) as the handoff rather than inventing those values."
71
+ - "Lists honest Points to clarify as the handoff rather than inventing values, and TYPES each one (pregunta abierta / suposición tomada / decisión diferida / área no formulable) so clarify knows whether to ask it, validate it, or leave it alone; a suposición carries its basis."
72
72
  - "Ends by pointing to the clarify phase as the next step in the SDD chain."
73
73
 
74
74
  - scenario: "A user pastes a rough one-liner: 'Let users export all their data as a download.' Show how you'd elicit and capture this without over-asking."
75
75
  must_include:
76
76
  - "Recovers the underlying problem/why rather than treating the feature request as the problem, and inherits any relevant constraints from the constitution."
77
- - "Applies the 'would a different answer change the spec?' test and asks only the genuinely scope-changing question(s), one at a time, in the user's register."
77
+ - "Applies the 'would a different answer change the contract?' test, then splits what is left by dependency: independent gaps go out together in one round with recommendations, and any gap whose answer hinges on another still-open one is held for the next round rather than asked blind."
78
78
  - "Captures observable behaviour (what the user sees/can do) and explicit non-goals / out-of-scope rather than implementation (no file format library, storage, or job-queue detail)."
79
- - "Turns answers into binary acceptance criteria and defers unresolved items (e.g. data scope, retention, format) to Points to clarify instead of fabricating decisions."
79
+ - "Turns answers into binary acceptance criteria and defers unresolved items (e.g. data scope, retention, format) to typed Points to clarify instead of fabricating decisions, and checks the written file against the phase's exit gate before calling it done."
80
80
  - "Notes that the spec is complete-enough-to-plan with open points remaining, and hands off to clarify — not to plan or implementation."
81
81
  - "After the user answers a question, folds the answer in, states what changed, shows the revised spec, and asks for approval AGAIN — it does not treat the answer as approval of the spec, including when the user picked the recommended option."
82
82
  - "If told to run the whole chain up front, records the approval as autopilot rather than item-by-item, and says the spec is the artifact to review after the fact."
@@ -31,13 +31,49 @@ and the intent itself. Only what survives as unknown becomes a question or a
31
31
  What you genuinely cannot resolve here is exactly what `clarify` exists for.
32
32
  Naming it is the correct outcome, not a failure.
33
33
 
34
- ## The one-question-at-a-time pattern
34
+ ## The frontier pattern
35
35
 
36
- A question earns a turn only if a *different answer would change the spec*.
36
+ A gap earns a question only if a *different answer would change the contract*.
37
37
  Apply this test before asking:
38
38
 
39
39
  > "If they answer A vs B, does a goal, a user, the scope, or an acceptance
40
- > criterion change?" — No → don't ask; infer or defer. Yes → ask, alone.
40
+ > criterion change?" — No → don't ask; infer or type it as a point to clarify.
41
+ > Yes → it is a question.
42
+
43
+ Then decide *when* to ask it. Model the gaps as a tree: every decision branches
44
+ into the decisions hanging off it. The **frontier** is every gap whose
45
+ prerequisites are already settled — what you can ask now without guessing at
46
+ answers you have not heard. Ask the whole frontier in one round; ask nothing
47
+ that depends on an answer still pending in that same round.
48
+
49
+ ```text
50
+ Round 1 (frontier: 3 independent gaps)
51
+ ❓ **Q1 — <title>**: <body, options if you have them>
52
+ ➡️ <your recommended answer>
53
+ ---
54
+ ❓ **Q2 — <title>**: …
55
+ ➡️ …
56
+ ---
57
+ ❓ **Q3 — <title>**: …
58
+ ➡️ …
59
+
60
+ → user answers → fold in → recompute the frontier → Round 2
61
+ ```
62
+
63
+ Where the harness offers a native question selector, emit the round through it;
64
+ otherwise emit the numbered text above. Same content either way.
65
+
66
+ **Facts are yours, decisions are theirs.** A gap that needs a fact from the
67
+ environment (a file, a config, a version) is legwork, not a question: go find
68
+ it. Don't block the round on it — a running search is an unsettled prerequisite,
69
+ so only its dependents wait. Ask the rest of the frontier now.
70
+
71
+ **A frontier of one** is one question, and needs no apology. **A frontier of
72
+ zero** is silence: never invent a question to look diligent.
73
+
74
+ **If an answer redefines a question you already emitted this round**, say so and
75
+ drop it. Re-ask it next round. An answer given under a premise that has since
76
+ moved is worse than no answer, because it looks settled.
41
77
 
42
78
  Phrase by register:
43
79
 
@@ -48,8 +84,10 @@ Phrase by register:
48
84
  - **Technical / L0-L1** — terse, decision-shaped:
49
85
  > "Expired-link recovery in scope, or defer?"
50
86
 
51
- Always: ask → wait → record the answer in the relevant section → confirm at L2/L3
52
- → ask the next. Never present a numbered list of ten questions.
87
+ Always: emit the round → wait → record each answer in its section → confirm at
88
+ L2/L3 → recompute the frontier. The thing to avoid was never two questions in
89
+ one message; it was ten questions whose answers depend on each other, which is
90
+ what crossing a dependency produces.
53
91
 
54
92
  ## Turning answers into testable criteria
55
93
 
@@ -64,14 +102,16 @@ link" action that issues a fresh one.
64
102
  ```
65
103
 
66
104
  If the answer is fuzzy ("it should feel fast"), do not invent a number — push
67
- once for a concrete figure; if none is available, file it under *Points to
68
- clarify* with the assumption you're carrying meanwhile.
105
+ once for a concrete figure; if none is available, file it as a
106
+ **suposición tomada** with its basis and its risk, which is what makes it
107
+ something `clarify` can validate instead of re-ask.
69
108
 
70
109
  ## When to stop
71
110
 
72
- Stop eliciting when the WHAT and WHY are complete enough that `plan` could start
73
- without guessing at scope. Lingering unknowns are fine — they belong in *Points
74
- to clarify*. Over-asking to feel thorough is itself an anti-pattern: it burns the
111
+ Stop when the frontier is empty: every branch visited, nothing left silently
112
+ assumed. Then run the exit gate (`npm run spec:gate <path>`) on the written
113
+ file — the bound is a property of the artifact, not of your confidence.
114
+ Lingering unknowns are fine, and belong in *Points to clarify*, typed. Over-asking to feel thorough is itself an anti-pattern: it burns the
75
115
  user's patience and pushes them to rubber-stamp answers they haven't thought
76
116
  through. A short spec with three honest open points beats a long spec with three
77
117
  fabricated ones.
@@ -50,16 +50,30 @@ checkable by `verify` and convertible to a `tasks` done-check.>
50
50
  - Given <state>, When <action>, Then <observable outcome>.
51
51
 
52
52
  ## Points to clarify
53
- <The handoff to the `clarify` phase. Open questions, assumptions you made and
54
- on what basis, decisions deferred. This list being non-empty is normal.>
55
- - [ ] <Open question> — (assumption made: <…>, basis: <…>)
56
- - [ ] <Deferred decision>
53
+ <The typed handoff to `clarify`. Every entry declares which of the four it is,
54
+ because each one gets a different action from the next phase. Non-empty is
55
+ normal; untyped is not — an untyped entry is read as `pregunta abierta`, the
56
+ costliest of the four.>
57
+ - **pregunta abierta** — <formulable now, unanswered. clarify asks it.>
58
+ - **suposición tomada** — <what you decided.> *Base:* <why.> *Riesgo:* <what
59
+ changes if it turns out wrong.> clarify validates it rather than re-asking.
60
+ - **decisión diferida** — <sharp, out of this cycle on purpose. clarify leaves
61
+ it.>
62
+ - **área no formulable** — <you can tell something is coming and cannot phrase
63
+ the question yet. clarify notes it; it graduates when it sharpens.>
57
64
  ```
58
65
 
59
66
  ## Field notes
60
67
 
61
68
  - **Status** moves `draft` → `clarified` (after the `clarify` phase) → `planned`
62
- (once `plan` exists). Don't invent other states.
69
+ (once `plan` exists). Don't invent other states. An approval obtained as a
70
+ blanket "just run it" is recorded as **approved in autopilot**, not flat.
71
+ - **Before you call it written**, run `npm run spec:gate <path>`. It checks that
72
+ every section here carries content or an explicit open point, and prints the
73
+ clauses it cannot check (the unmarked assumption is yours).
74
+ - **Sharpness, not difficulty**, sorts the last two types from the first: *can
75
+ you state the question precisely now?* Not *can you answer it?* Anything past
76
+ what this change is for goes to **Non-goals**, where it never graduates.
63
77
  - **Behaviour** is where HOW leaks in most. Audit every verb: "queries",
64
78
  "caches", "calls", "stores in" are implementation. Replace with the observable
65
79
  effect ("shows", "lets the user", "prevents", "remembers across visits").