@agentshouse/kit 0.2.1-cf6326dfa5c3e → 0.2.1-cf6a92e13f031

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 (130) hide show
  1. package/README.md +22 -22
  2. package/dist/acp.js +2 -2
  3. package/dist/agents.js +2 -2
  4. package/dist/api.js +5 -5
  5. package/dist/bootstrap.json +4 -4
  6. package/dist/bridge.js +1 -1
  7. package/dist/{inputs.js → calls.js} +20 -20
  8. package/dist/clis.js +6 -3
  9. package/dist/{stream.js → connection.js} +30 -27
  10. package/dist/conversations.js +220 -105
  11. package/dist/copies.js +15 -29
  12. package/dist/end.js +6 -2
  13. package/dist/events.js +2 -2
  14. package/dist/files.js +123 -37
  15. package/dist/git.js +1 -1
  16. package/dist/house-cli.js +81 -86
  17. package/dist/instructions.js +28 -8
  18. package/dist/kit-cli.js +2 -2
  19. package/dist/login.js +1 -3
  20. package/dist/mcp.js +4 -2
  21. package/dist/placement.js +11 -2
  22. package/dist/resident.js +38 -32
  23. package/dist/scope.js +3 -0
  24. package/dist/service.js +1 -1
  25. package/dist/sign-in.js +19 -19
  26. package/dist/skills.js +12 -93
  27. package/dist/transcription.js +51 -20
  28. package/dist/update.js +32 -32
  29. package/dist/web-wizard.js +100 -0
  30. package/dist/wire.js +19 -3
  31. package/package.json +6 -6
  32. package/how-we-work.md +0 -33
  33. package/skills/ask-matt/LICENSE +0 -21
  34. package/skills/ask-matt/PHASE-BOUNDARIES.md +0 -55
  35. package/skills/ask-matt/SKILL.md +0 -97
  36. package/skills/ask-matt/agents/openai.yaml +0 -5
  37. package/skills/code-review/LICENSE +0 -21
  38. package/skills/code-review/SKILL.md +0 -89
  39. package/skills/code-review/agents/openai.yaml +0 -3
  40. package/skills/codebase-design/DEEPENING.md +0 -37
  41. package/skills/codebase-design/DESIGN-IT-TWICE.md +0 -44
  42. package/skills/codebase-design/LICENSE +0 -21
  43. package/skills/codebase-design/SKILL.md +0 -114
  44. package/skills/codebase-design/agents/openai.yaml +0 -3
  45. package/skills/diagnosing-bugs/LICENSE +0 -21
  46. package/skills/diagnosing-bugs/SKILL.md +0 -138
  47. package/skills/diagnosing-bugs/agents/openai.yaml +0 -3
  48. package/skills/diagnosing-bugs/scripts/hitl-loop.template.sh +0 -44
  49. package/skills/domain-modeling/ADR-FORMAT.md +0 -47
  50. package/skills/domain-modeling/GLOSSARY-FORMAT.md +0 -60
  51. package/skills/domain-modeling/LICENSE +0 -21
  52. package/skills/domain-modeling/SKILL.md +0 -74
  53. package/skills/domain-modeling/agents/openai.yaml +0 -3
  54. package/skills/grill-me/LICENSE +0 -21
  55. package/skills/grill-me/SKILL.md +0 -7
  56. package/skills/grill-me/agents/openai.yaml +0 -5
  57. package/skills/grill-with-docs/LICENSE +0 -21
  58. package/skills/grill-with-docs/SKILL.md +0 -7
  59. package/skills/grill-with-docs/agents/openai.yaml +0 -5
  60. package/skills/grilling/LICENSE +0 -21
  61. package/skills/grilling/SKILL.md +0 -30
  62. package/skills/grilling/agents/openai.yaml +0 -3
  63. package/skills/handoff/LICENSE +0 -21
  64. package/skills/handoff/SKILL.md +0 -16
  65. package/skills/handoff/agents/openai.yaml +0 -5
  66. package/skills/implement/LICENSE +0 -21
  67. package/skills/implement/SKILL.md +0 -17
  68. package/skills/implement/agents/openai.yaml +0 -5
  69. package/skills/implement-spec/LICENSE +0 -21
  70. package/skills/implement-spec/SKILL.md +0 -40
  71. package/skills/implement-spec/agents/openai.yaml +0 -5
  72. package/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
  73. package/skills/improve-codebase-architecture/LICENSE +0 -21
  74. package/skills/improve-codebase-architecture/SKILL.md +0 -71
  75. package/skills/improve-codebase-architecture/agents/openai.yaml +0 -5
  76. package/skills/pr/CREDITS.md +0 -3
  77. package/skills/pr/LICENSE +0 -21
  78. package/skills/pr/SKILL.md +0 -170
  79. package/skills/pr/agents/openai.yaml +0 -3
  80. package/skills/prototype/LICENSE +0 -21
  81. package/skills/prototype/LOGIC.md +0 -67
  82. package/skills/prototype/SKILL.md +0 -26
  83. package/skills/prototype/UI.md +0 -112
  84. package/skills/prototype/agents/openai.yaml +0 -3
  85. package/skills/research/LICENSE +0 -21
  86. package/skills/research/SKILL.md +0 -12
  87. package/skills/research/agents/openai.yaml +0 -3
  88. package/skills/retro/LICENSE +0 -21
  89. package/skills/retro/SKILL.md +0 -44
  90. package/skills/retro/agents/openai.yaml +0 -5
  91. package/skills/tdd/LICENSE +0 -21
  92. package/skills/tdd/SKILL.md +0 -38
  93. package/skills/tdd/agents/openai.yaml +0 -3
  94. package/skills/tdd/mocking.md +0 -59
  95. package/skills/tdd/tests.md +0 -77
  96. package/skills/teach/GLOSSARY-FORMAT.md +0 -35
  97. package/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
  98. package/skills/teach/LICENSE +0 -21
  99. package/skills/teach/MISSION-FORMAT.md +0 -31
  100. package/skills/teach/RESOURCES-FORMAT.md +0 -32
  101. package/skills/teach/SKILL.md +0 -140
  102. package/skills/teach/agents/openai.yaml +0 -5
  103. package/skills/to-questionnaire/LICENSE +0 -21
  104. package/skills/to-questionnaire/SKILL.md +0 -54
  105. package/skills/to-questionnaire/agents/openai.yaml +0 -5
  106. package/skills/to-spec/LICENSE +0 -21
  107. package/skills/to-spec/SKILL.md +0 -75
  108. package/skills/to-spec/agents/openai.yaml +0 -5
  109. package/skills/to-tickets/LICENSE +0 -21
  110. package/skills/to-tickets/SKILL.md +0 -105
  111. package/skills/to-tickets/agents/openai.yaml +0 -5
  112. package/skills/triage/AGENT-BRIEF.md +0 -207
  113. package/skills/triage/LICENSE +0 -21
  114. package/skills/triage/OUT-OF-SCOPE.md +0 -105
  115. package/skills/triage/SKILL.md +0 -112
  116. package/skills/triage/agents/openai.yaml +0 -5
  117. package/skills/wait-what/LICENSE +0 -21
  118. package/skills/wait-what/SKILL.md +0 -7
  119. package/skills/wait-what/agents/openai.yaml +0 -5
  120. package/skills/wayfinder/LICENSE +0 -21
  121. package/skills/wayfinder/SKILL.md +0 -128
  122. package/skills/wayfinder/agents/openai.yaml +0 -5
  123. package/skills/wizard/LICENSE +0 -21
  124. package/skills/wizard/SKILL.md +0 -44
  125. package/skills/wizard/agents/openai.yaml +0 -3
  126. package/skills/wizard/template.sh +0 -223
  127. package/skills/writing-for-agents/LICENSE +0 -21
  128. package/skills/writing-for-agents/SKILL-MECHANICS.md +0 -22
  129. package/skills/writing-for-agents/SKILL.md +0 -81
  130. package/skills/writing-for-agents/agents/openai.yaml +0 -3
package/dist/update.js CHANGED
@@ -15,8 +15,8 @@ function pending() {
15
15
  function outcome() {
16
16
  return join(directory(), 'outcome');
17
17
  }
18
- function unit(inputId) {
19
- return `house-kit-update-${inputId}`;
18
+ function unit(callId) {
19
+ return `house-kit-update-${callId}`;
20
20
  }
21
21
  function manager() {
22
22
  return service() === 'user' ? ['--user'] : [];
@@ -33,7 +33,7 @@ function placement() {
33
33
  function record() {
34
34
  return `outcome=$1; shift; bash "$0" "$@"; printf %s "$?" > "$outcome"; ${[...elevated(), 'systemctl', ...manager(), 'start', 'house-kit.service'].join(' ')}`;
35
35
  }
36
- async function pendingInput() {
36
+ async function pendingCall() {
37
37
  try {
38
38
  return JSON.parse(await readFile(pending(), 'utf8')).input_id;
39
39
  }
@@ -47,26 +47,26 @@ async function recorded() {
47
47
  return null;
48
48
  return status.trim() === '0' ? {} : { refused: `the Kit bootstrap exited with ${status.trim()}` };
49
49
  }
50
- async function forget(inputId) {
51
- if ((await pendingInput()) !== inputId)
50
+ async function forget(callId) {
51
+ if ((await pendingCall()) !== callId)
52
52
  return;
53
53
  await rm(pending(), { force: true });
54
54
  await rm(outcome(), { force: true });
55
55
  }
56
- async function finished(inputId) {
56
+ async function finished(callId) {
57
57
  for (;;) {
58
- const ack = await recorded();
59
- if (ack !== null)
60
- return ack;
58
+ const result = await recorded();
59
+ if (result !== null)
60
+ return result;
61
61
  // systemctl answers at once, so ten seconds only bounds a stuck service manager.
62
- if ((await run('systemctl', [...manager(), 'is-active', '--quiet', unit(inputId)], 10_000)).status !== 0) {
62
+ if ((await run('systemctl', [...manager(), 'is-active', '--quiet', unit(callId)], 10_000)).status !== 0) {
63
63
  return (await recorded()) ?? { refused: 'the Kit bootstrap did not finish' };
64
64
  }
65
65
  // The bootstrap runs for minutes, so checking each second sees its outcome within a second at little cost.
66
66
  await new Promise((resolve) => setTimeout(resolve, 1000));
67
67
  }
68
68
  }
69
- function rerun(script, inputId, flags) {
69
+ function rerun(script, callId, flags) {
70
70
  return new Promise((resolve) => {
71
71
  const [command, ...args] = [
72
72
  ...elevated(),
@@ -76,7 +76,7 @@ function rerun(script, inputId, flags) {
76
76
  '--wait',
77
77
  '--collect',
78
78
  '--quiet',
79
- `--unit=${unit(inputId)}`,
79
+ `--unit=${unit(callId)}`,
80
80
  `--setenv=HOME=${homedir()}`,
81
81
  `--setenv=HOUSE_KIT_HOME=${kitHome()}`,
82
82
  '/bin/sh',
@@ -88,50 +88,50 @@ function rerun(script, inputId, flags) {
88
88
  ...flags,
89
89
  ];
90
90
  const child = spawn(command, args, { stdio: ['ignore', 'ignore', 'inherit'] });
91
- child.on('error', () => resolve({ refused: 'no service manager runs this Kit' }));
91
+ child.on('error', () => resolve({ refused: 'no service manager runs this Kit process' }));
92
92
  child.on('close', () => resolve(null));
93
93
  });
94
94
  }
95
- export class Updates {
96
- inputs;
95
+ export class KitUpdate {
96
+ calls;
97
97
  queue = Promise.resolve();
98
- constructor(inputs) {
99
- this.inputs = inputs;
98
+ constructor(calls) {
99
+ this.calls = calls;
100
100
  }
101
101
  async resumed() {
102
- const inputId = await pendingInput();
103
- if (inputId === null)
102
+ const callId = await pendingCall();
103
+ if (callId === null)
104
104
  return;
105
- await this.enqueue(inputId, () => finished(inputId));
105
+ await this.enqueue(callId, () => finished(callId));
106
106
  }
107
- start(input) {
108
- void this.enqueue(input.input_id, () => this.carry(input));
107
+ start(call) {
108
+ void this.enqueue(call.input_id, () => this.carry(call));
109
109
  }
110
- enqueue(inputId, work) {
110
+ enqueue(callId, work) {
111
111
  const before = this.queue;
112
- const carried = this.inputs.carry(inputId, async () => {
112
+ const carried = this.calls.carry(callId, async () => {
113
113
  await before;
114
- return { ack: await work(), acknowledged: () => forget(inputId) };
114
+ return { result: await work(), returned: () => forget(callId) };
115
115
  });
116
116
  this.queue = before.then(() => carried);
117
117
  return carried;
118
118
  }
119
- async carry(input) {
120
- if ((await pendingInput()) === input.input_id)
121
- return finished(input.input_id);
122
- const answer = await fetch(input.bootstrap);
119
+ async carry(call) {
120
+ if ((await pendingCall()) === call.input_id)
121
+ return finished(call.input_id);
122
+ const answer = await fetch(call.bootstrap);
123
123
  if (!answer.ok)
124
124
  return { refused: `the Kit bootstrap could not be downloaded: ${answer.status}` };
125
125
  const script = Buffer.from(await answer.arrayBuffer());
126
- if (createHash('sha256').update(script).digest('hex') !== input.sha256) {
126
+ if (createHash('sha256').update(script).digest('hex') !== call.sha256) {
127
127
  return { refused: 'the Kit bootstrap does not match its sha256' };
128
128
  }
129
129
  await mkdir(directory(), { recursive: true, mode: 0o700 });
130
130
  const path = join(directory(), 'connect-linux.sh');
131
131
  await writeFile(path, script, { mode: 0o700 });
132
132
  await rm(outcome(), { force: true });
133
- await writeFile(pending(), `${JSON.stringify({ input_id: input.input_id })}\n`, { mode: 0o600 });
134
- return (await rerun(path, input.input_id, input.update_clis ? ['--update-clis'] : [])) ?? (await recorded()) ?? {
133
+ await writeFile(pending(), `${JSON.stringify({ input_id: call.input_id })}\n`, { mode: 0o600 });
134
+ return (await rerun(path, call.input_id, call.update_clis ? ['--update-clis'] : [])) ?? (await recorded()) ?? {
135
135
  refused: 'the Kit bootstrap did not finish',
136
136
  };
137
137
  }
@@ -0,0 +1,100 @@
1
+ import { loginPath, onLoginPath, withoutProxy } from './clis.js';
2
+ import { killTree } from './scope.js';
3
+ const TERMINAL = 'xterm-256color';
4
+ const SIGNALLED = 128;
5
+ const NO_BASH = "bash is not on the login shell's PATH";
6
+ const LOST = { refused: 'the Kit lost its connection to House' };
7
+ function causeOf(error) {
8
+ return error instanceof Error ? error.message : String(error);
9
+ }
10
+ function failed(cause) {
11
+ process.stderr.write(`kit: a Web Wizard could not start: ${cause}\n`);
12
+ return { refused: `the script could not start: ${cause}` };
13
+ }
14
+ export class WebWizards {
15
+ calls;
16
+ send;
17
+ runs = new Map();
18
+ constructor(calls, send) {
19
+ this.calls = calls;
20
+ this.send = send;
21
+ }
22
+ start(call) {
23
+ void this.calls.carry(call.input_id, () => this.run(call));
24
+ }
25
+ notified(notification) {
26
+ const run = this.runs.get(String(notification.wizard));
27
+ if (run === undefined)
28
+ return;
29
+ if (notification.type === 'wizard_input')
30
+ this.typed(run, String(notification.data));
31
+ if (notification.type === 'wizard_size')
32
+ this.resized(run, { cols: Number(notification.cols), rows: Number(notification.rows) });
33
+ if (notification.type === 'wizard_end')
34
+ this.end(run, {});
35
+ }
36
+ disconnected() {
37
+ for (const run of this.runs.values())
38
+ this.end(run, LOST);
39
+ }
40
+ async run(call) {
41
+ const run = { terminal: null, size: null, typed: [], ended: null, sized: Promise.withResolvers() };
42
+ this.runs.set(call.input_id, run);
43
+ try {
44
+ return { result: await this.ran(call.input_id, call.script, run) };
45
+ }
46
+ finally {
47
+ this.runs.delete(call.input_id);
48
+ }
49
+ }
50
+ async ran(wizard, script, run) {
51
+ let terminal;
52
+ try {
53
+ const { spawn } = await import('@lydell/node-pty');
54
+ const shell = await onLoginPath('bash');
55
+ if (shell === null)
56
+ return failed(NO_BASH);
57
+ const path = await loginPath();
58
+ await run.sized.promise;
59
+ if (run.ended !== null)
60
+ return run.ended;
61
+ terminal = spawn(shell, ['-c', script], {
62
+ name: TERMINAL,
63
+ ...run.size,
64
+ cwd: process.cwd(),
65
+ env: { ...withoutProxy(), PATH: path },
66
+ });
67
+ }
68
+ catch (error) {
69
+ return failed(causeOf(error));
70
+ }
71
+ run.terminal = terminal;
72
+ terminal.onData((data) => this.send({ type: 'wizard_output', wizard, data }));
73
+ for (const data of run.typed.splice(0))
74
+ terminal.write(data);
75
+ const exited = await new Promise((resolve) => terminal.onExit(resolve));
76
+ return run.ended ?? { exit_code: exited.signal ? SIGNALLED + exited.signal : exited.exitCode };
77
+ }
78
+ typed(run, data) {
79
+ if (run.terminal === null)
80
+ run.typed.push(data);
81
+ else
82
+ run.terminal.write(data);
83
+ }
84
+ resized(run, size) {
85
+ run.size = size;
86
+ run.sized.resolve();
87
+ try {
88
+ run.terminal?.resize(size.cols, size.rows);
89
+ }
90
+ catch { }
91
+ }
92
+ end(run, result) {
93
+ if (run.ended !== null)
94
+ return;
95
+ run.ended = result;
96
+ run.sized.resolve();
97
+ if (run.terminal !== null)
98
+ killTree(run.terminal);
99
+ }
100
+ }
package/dist/wire.js CHANGED
@@ -1,6 +1,22 @@
1
+ import { newerThanHouse, updateRequired } from './end.js';
2
+ import { machine } from './placement.js';
1
3
  import { refusalOf } from './refusals.js';
2
- export const KIT_WIRE = 2;
4
+ export const KIT_WIRE = 3;
3
5
  export const KIT_WIRE_HEADER = 'x-house-kit-wire';
4
- export function tooOld(text) {
5
- return refusalOf(text)?.code === 'kit_update_required';
6
+ function newer(text) {
7
+ let body;
8
+ try {
9
+ body = JSON.parse(text);
10
+ }
11
+ catch {
12
+ return null;
13
+ }
14
+ return body?.error?.code === 'kit_newer_than_house' ? body.error : null;
15
+ }
16
+ export function endUnserved(text) {
17
+ if (refusalOf(text)?.code === 'kit_update_required')
18
+ updateRequired();
19
+ const refused = newer(text);
20
+ if (refused !== null)
21
+ newerThanHouse(refused.release, refused.commands[machine()]);
6
22
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agentshouse/kit",
3
- "version": "0.2.1-cf6326dfa5c3e",
4
- "description": "House Kit connects an Environment to agents.house.",
3
+ "version": "0.2.1-cf6a92e13f031",
4
+ "description": "Kit connects an Environment to agents.house.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -16,19 +16,19 @@
16
16
  "./bootstrap": "./dist/bootstrap.json"
17
17
  },
18
18
  "files": [
19
- "dist",
20
- "how-we-work.md",
21
- "skills"
19
+ "dist"
22
20
  ],
23
21
  "scripts": {
24
22
  "build": "tsc -p tsconfig.build.json && node scripts/bootstrap-manifest.mjs",
25
23
  "engine": "mkdir -p tmp/engine && docker run --rm -v \"$PWD:/kit\" -w /kit alpine:3.24@sha256:294b683cb724975bec92580e1e685676bd4b50bda910ddb8c51d4cabeaec77e6 sh scripts/engine.sh tmp/engine",
26
- "sync-skills": "node scripts/sync-skills.mjs",
24
+ "follow-skills": "node scripts/follow-skills.mjs",
27
25
  "test": "tsc -p tsconfig.json && vitest run"
28
26
  },
29
27
  "dependencies": {
30
28
  "@agentclientprotocol/sdk": "1.7.0",
31
29
  "@agentshouse/mdmodel": "0.1.0-cabd61587647f",
30
+ "@agentshouse/skills": "0.1.0-c6411c39c6d0f",
31
+ "@lydell/node-pty": "1.2.0-beta.15",
32
32
  "yaml": "2.9.1"
33
33
  },
34
34
  "peerDependencies": {
package/how-we-work.md DELETED
@@ -1,33 +0,0 @@
1
- # How we work
2
-
3
- A Room is where information people share is kept; it is not the place for
4
- private information. Work goes into the Room it belongs to, or the First Room
5
- when none is named.
6
-
7
- Every House answer carries the `url` of what it names; send the User that link.
8
-
9
- The skills are already set up; never run `setup-matt-pocock-skills`.
10
-
11
- ## Where skill output goes
12
-
13
- - Glossary (`GLOSSARY.md`): `glossary.md`
14
- - Decisions (ADRs): `decisions/NNNN-<slug>.md`
15
- - Plan (spec): `projects/<name>/plan.md`
16
- - Tasks (tickets): `projects/<name>/tasks/NN-<slug>.md`, with a
17
- `Status:` line (`needs-triage`, `needs-info`, `ready-for-agent`,
18
- `ready-for-human`, `wontfix`, or `done` once implemented), a
19
- `Category:` line (`bug`, `enhancement`), a `Blocked by:` line and comments
20
- under `## Comments`; triage takes no pull requests
21
- - Rejected requests (triage): `out-of-scope/<concept>.md`
22
- - Implementation notes (implement-spec): `projects/<name>/notes/`
23
- - PR bodies (pr): `projects/<name>/prs/<branch>.md`
24
- - Map (Wayfinding): `projects/<name>/map.md`, its tasks under
25
- `tasks/` with `Type:`, `Status: claimed|resolved` and `Blocked by:` lines
26
- - Research: `research/<slug>.md`
27
- - Architecture reports (improve-codebase-architecture): `architecture/<slug>.html`
28
- - Handoffs: `handoffs/<slug>.md`
29
- - Questionnaires: `questionnaires/<slug>.md`
30
- - Retrospectives (retro): `retros/<date>-<slug>.md`
31
- - Wizards: `wizards/<slug>.sh`; the values they capture stay out of the Room
32
- - Learning: `learning/<topic>/`
33
- - Prototype: one HTML file with every variant on one page.
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Matt Pocock
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,55 +0,0 @@
1
- # Phase boundaries
2
-
3
- A **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. The definition is fuzzy on purpose: a phase ends when you think *"ok, we're done with that"*.
4
-
5
- The **phase boundary** is the gap between two phases, and it is the only place this decision belongs. Mid-phase there is no decision to make: continue, or split the work that's left into subagents. Compacting mid-phase makes the agent lose the thread.
6
-
7
- ## The five options
8
-
9
- | Option | What it does |
10
- | ------------ | --------------------------------------------------------------- |
11
- | **Continue** | Stay in the session. No context switch at all. |
12
- | **`/clear`** | Empty the context window and start from nothing. |
13
- | **`/handoff`** | Write a portable markdown file and seed a session anywhere with it. |
14
- | **Subagent** | Send the task to its own context window and get a report back. |
15
- | **`/compact`** | Compress this context and seed a fresh session with the summary. |
16
-
17
- ## The tree
18
-
19
- Work top to bottom at the boundary. The first **yes** wins.
20
-
21
- **1. Can you continue in this session?** Two things make the answer yes: the next phase needs this phase as a **primary source**, or you have enough [smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone) left (~150k tokens) for the next phase to fit. Grilling → implementation is the standard yes: the implementation wants the reasoning verbatim, not a summary of it. Continue costs nothing and loses nothing, so rule it out before anything else.
22
-
23
- **2. Is the context irrelevant to what comes next?** Is everything in this session (the exploration, the decisions, the dead ends) disposable? If so, **`/clear`**. It is the cheapest move on the board: it takes no time and hands back the whole window. `/clear` also isn't terminal: the old session stays resumable.
24
-
25
- The cost of getting this wrong is one-way. Clear a *relevant* context and you lose the **why** behind what you built, and no amount of reading the diff back gets it returned.
26
-
27
- **3. Do you need to hand off?** `/handoff` is narrow. You need it only when you are:
28
-
29
- - swapping to a **new harness** (Claude → Codex),
30
- - moving to a **new directory** or repo,
31
- - sending the work to a **colleague**,
32
- - or forking a side task you found **mid-phase** without derailing what you're doing.
33
-
34
- That list is the whole clause. What `/handoff` buys is **portability**: a file that travels. If nothing is travelling, you don't need it.
35
-
36
- **4. Can the task be done AFK?** Is it scoped tightly enough to run with you away from the keyboard, no steering? Then send it to a **subagent** and leave this session untouched. Automated review is the standard case: the agent reads the diff and reports, and you aren't needed while it does.
37
-
38
- **5. Otherwise, `/compact`.** Relevant context, same harness, same directory, and you need to stay in the loop: this is where the tree lands, and it lands here often. Pass it an instruction (`/compact we're going to QA this area`) so the summary keeps what the next phase needs.
39
-
40
- `/compact` is the **default, not the first reach**. It sits at the bottom because the four questions above it are all cheaper or more precise. The failure mode when people start here is a fresh session that is confidently wrong about a decision the summary flattened.
41
-
42
- ## Primary and secondary sources
43
-
44
- Every move except **Continue** turns a **primary source** into a **secondary source**: the session as it happened, replaced by a summary of it. The trade is always the same shape:
45
-
46
- | Source | Information | Noise | Room to move |
47
- | --------------------------------- | ----------- | ----- | ------------ |
48
- | Primary (Continue) | Full | Lots | Little |
49
- | Secondary (`/compact`, `/handoff`) | Lossy | Less | Lots |
50
-
51
- This is why question 1 comes first. You only pay the lossiness when staying costs more than it saves.
52
-
53
- ## These are judgement calls
54
-
55
- The questions are not objective: each has taste in it, and the same boundary can go two ways on two days. The value is in asking them **in order**, at the boundary rather than in the middle of the work.
@@ -1,97 +0,0 @@
1
- ---
2
- name: ask-matt
3
- description: Ask which skill or flow fits your situation. A router over the skills in this repo.
4
- disable-model-invocation: true
5
- ---
6
-
7
- # Ask Matt
8
-
9
- You don't remember every skill, so ask.
10
-
11
- Before stating what a skill does or recommending a step be skipped, read that skill's SKILL.md: the summaries here are for orientation only.
12
-
13
- A **flow** is a path through the skills. Most paths run along one **main flow**, and two **on-ramps** merge onto it. Everything else is standalone, or a vocabulary layer that runs underneath.
14
-
15
- ## The main flow: idea → ship
16
-
17
- The route most work travels. You have an idea and want it built.
18
-
19
- 1. **`/grill-with-docs`** sharpens the idea by interview. Start here whenever you are **working in a working directory**: it's stateful, retaining what it learns in `GLOSSARY.md` and ADRs. (No working directory? Use `/grill-me` instead, covered under Standalone. Both run the same `/grilling` primitive; `grill-with-docs` is the one that leaves a paper trail, which makes it the better of the two whenever a repo is there to leave it in.)
20
- 2. **Branch: can you settle every question in conversation?** If a question needs a runnable answer (state, business logic, a UI you have to see), detour through a prototype, bridged by **`/handoff`** in both directions (a prototype lives in its own directory, which is exactly what `/handoff` is for; see Phase boundaries):
21
- - **`/handoff`** out, then open a fresh session against that file,
22
- - **`/prototype`** to answer the question with throwaway code,
23
- - **`/handoff`** back what you learned, and reference it from the original idea thread.
24
- 3. **Branch: is this a multi-session build?**
25
- - **Yes** → **`/to-spec`** (turn the thread into a spec), then **`/to-tickets`** to split it into tracer-bullet tickets, each declaring its **blocking edges**. Then work the tickets one of two ways:
26
- - **`/implement`** per ticket, **`/clear`ing context between each one**. On a local tracker that's one file per ticket under `.scratch/<feature>/issues/`, worked blockers-first by hand; on a real tracker the edges become native blocking links, so any ticket whose blockers are done can be grabbed. Each ticket is self-contained, so the last one's context is disposable.
27
- - **`/implement-spec`** for the whole spec in one run. It reads the tickets as a **task graph**, runs implementer subagents across the ready **frontier** in parallel, and lands everything on one **integration branch**. Reach for it when you'd rather orchestrate the build than drive each ticket yourself.
28
- - **No** → **`/implement`** right here, in the same context window.
29
-
30
- Either way, the code gets built by driving **`/tdd`** (one red-green slice at a time) and closes out with **`/code-review`**, a two-axis review (Standards + Spec) of the diff. `/implement` runs both per ticket; `/implement-spec`'s implementers each drive `/tdd`, and it runs one `/code-review` over the integration branch. Reach for **`/tdd`** on its own when you just want to build a concrete behaviour test-first without a full spec, and **`/code-review`** on its own whenever you want to review a branch or PR against a fixed point.
31
-
32
- When the work goes up as a pull request, **`/pr`** shapes the body: the smallest visual that shows the change, before/after evidence that it works, and a one-way or two-way door call. It's model-invoked, so the agent reaches for it whenever it writes a PR.
33
-
34
- 4. **`/retro`** closes the loop. After a build, and especially one that went sideways, it looks back over the session and suggests changes to the agent's **environment**, not the code: navigation pointers, automated checks, the coding standards `/code-review` enforces, steering files, tooling. Mechanical mistakes become deterministic checks; judgement calls become coding standards. The next build then starts from a better environment.
35
-
36
- ### Context hygiene
37
-
38
- Keep steps 1–3 in **one unbroken context window** (don't compact or clear until after `/to-tickets`) so the grilling, spec, and tickets all build on the same thinking. Each `/implement` then starts fresh, working from the ticket. Run `/retro` in the session it's looking back on, before you clear; after clearing, point it at that session's log instead.
39
-
40
- The limit on this is the **[smart zone](https://www.aihero.dev/ai-coding-dictionary/smart-zone)**: the window (~150k tokens on state-of-the-art models) within which the model still reasons sharply. If a session approaches it before `/to-tickets`, don't push on degraded; `/compact` at the nearest phase boundary and carry on (see Phase boundaries).
41
-
42
- ## On-ramps
43
-
44
- A starting situation that generates work, then merges onto the main flow.
45
-
46
- - **Bugs and requests piling up** → **`/triage`**. It moves issues through triage roles and produces agent-ready issues, which **`/implement`** later picks up.
47
-
48
- Triage is only for issues **you didn't create**: bug reports, incoming feature requests, anything that arrives raw. Tickets that `/to-tickets` produced are already agent-ready, so **don't triage them**.
49
-
50
- - **Something's broken** → **`/diagnosing-bugs`**. For the hard ones: the bug that resists a first glance, the intermittent flake, the regression that crept in between two known-good states. It refuses to theorise until it has a **tight feedback loop** (one command that already goes red on *this* bug), then fixes with a regression test. Once the fix is in, run **`/retro`** in the same session to ask what would have prevented the bug; where the real finding is that there's no good seam to lock it down, that's a job for **`/improve-codebase-architecture`**.
51
-
52
- - **A huge, foggy effort: a greenfield project or a huge feature build, too big for one session** → **`/wayfinder`**, the most cognitively demanding flow here. When the way from here to the destination isn't visible yet, it charts a **shared map** of **decision tickets** on the issue tracker and resolves them one at a time, producing **decisions, not deliverables**, until the fog is pushed back and the way is clear. Where **`/grill-with-docs`** sharpens an idea you can hold in one session, wayfinder is for the idea you can't, and it's slower and denser, so save it for exactly that, never a well-scoped feature.
53
-
54
- When the map clears, **it hands off, it doesn't build**: merge onto the main flow at **`/to-spec`**, which collapses the map's linked decisions into a buildable plan, then `/to-tickets` and `/implement` as usual. Looping the map straight into `/implement` skips that collapse and throws the linked detail away, so go straight to `/implement` only when the effort turned out genuinely small.
55
-
56
- ## Codebase health
57
-
58
- Not feature work, just upkeep.
59
-
60
- - **`/improve-codebase-architecture`** runs whenever you have a spare moment to keep the codebase good for agents to operate in. It surfaces **deepening opportunities**; picking one _generates an idea_ you can take into the main flow at `/grill-with-docs`. It's the survey that finds the candidates; **`/codebase-design`** (below) is the bench you design the chosen one on.
61
-
62
- ## Vocabulary underneath
63
-
64
- Two model-invoked references that run *beneath* the other skills, each the single source of truth for its vocabulary. Reach for them directly when the **words**, not the process, are the problem; or let the skills above pull them in.
65
-
66
- - **`/domain-modeling`**: sharpen the project's *domain* language: challenge a fuzzy term, resolve an overloaded word ("account" doing three jobs), record a hard-to-reverse decision as an ADR. It's the active discipline `/grill-with-docs` drives to keep `GLOSSARY.md` a clean glossary.
67
- - **`/codebase-design`** is the deep-module vocabulary (module, interface, depth, seam, adapter, leverage, locality) for designing a module's *shape*: a lot of behaviour behind a small interface at a clean seam. `/tdd` and `/improve-codebase-architecture` both speak it.
68
-
69
- ## Phase boundaries
70
-
71
- A **phase** is a chunk of work inside a session: the grilling, the implementation, the QA. At the **boundary** between two of them you have five options, and picking between them is the fuzziest decision in this whole map:
72
-
73
- - **Continue**: stay put. Costs nothing, loses nothing.
74
- - **`/clear`**: empty the window, when nothing here matters to what's next.
75
- - **`/handoff`** writes a portable markdown file. Narrow: only for a **new harness**, a **new directory**, a **colleague**, or forking a side task **mid-phase**. What it buys is portability.
76
- - **Subagent**: send a tightly-scoped task to its own window and get a report back.
77
- - **`/compact`** compresses this context and seeds a fresh session with it. The **default**, at the bottom of the tree rather than the first reach.
78
-
79
- Read [PHASE-BOUNDARIES.md](PHASE-BOUNDARIES.md) for the ordered tree: the five questions, the reasoning behind each branch, and why the primary-source cost makes **Continue** the one to rule out first. Make the decision **at** a boundary; mid-phase, continue or split the rest into subagents.
80
-
81
- ## Standalone
82
-
83
- Off the main flow entirely.
84
-
85
- - **`/grill-me`**: the same relentless interview as `/grill-with-docs`, but **stateless**: it saves nothing locally and builds no `GLOSSARY.md`. Reach for it when you are **not working in a working directory** (sharpening a plan, a design, a piece of writing, anything with no repo under it). If you are in a working directory, use `/grill-with-docs` instead: it runs the same interview and leaves a paper trail, so it is strictly the better one.
86
- - **`/grilling`** is the interview primitive itself: rounds, the frontier, facts are the agent's job and decisions are yours. `/grill-me` and `/grill-with-docs` are the two named ways in, and `/triage`, `/wayfinder` and `/improve-codebase-architecture` all run it internally. Reach for it directly only when you want the interview with no wrapper around it.
87
- - **`/prototype`** is a small, throwaway program that answers one design question: does this state model feel right, or what should this UI look like. Throwaway is a constraint on how the code is written, not a promise to destroy it: the answer folds into the real code, and the prototype itself is kept as a **primary source** on a `prototype/<name>` branch out of main, pointed at from the implementation issue. It's the detour in step 2 of the main flow, but reach for it any time a design question is hard to settle on paper.
88
- - **`/research`**: delegate reading legwork to a **background agent**: it investigates a question against **primary sources**, then leaves a cited Markdown file in the repo. Keep working while it reads. The file it produces is something to take *into* the main flow at `/grill-with-docs`, since research feeds the thinking rather than replacing it.
89
- - **`/to-questionnaire`** comes in when the thing blocking you isn't in your head or the codebase but in **someone else's**, and it writes them a questionnaire to fill in. It's the inverse of `/grill-me`: instead of interviewing you about the subject, it interviews you about the **send** (who it's going to, what you need back) and aims the questions at the gap. What comes back is material for `/grill-with-docs` or `/to-spec`.
90
- - **`/wizard`** is for the steps only a **human** can take: provisioning infrastructure, setting up credentials or CI secrets, clicking through an unfamiliar third-party dashboard, running a one-off migration or cutover. It generates an interactive bash script that opens each URL, captures each value, and writes it into `.env` and GitHub secrets, so the procedure stops being something you re-explain to an agent every time. Model-invoked, so the agent reaches for it the moment it hits a wall only you can pass. If the agent could just do it itself, it should; this is for where a human is genuinely in the loop.
91
- - **`/wait-what`** is the corrective for a message that didn't land. Use it mid-conversation, inside any other skill, and the agent re-pitches what it just said with the context you were missing, in plain English, using the `GLOSSARY.md` vocabulary. It works after the fact; `/grill-with-docs` is the upfront cure, because a shared language agreed early is what stops the jargon arriving at all.
92
- - **`/teach`**: learn a concept over multiple sessions, using the current directory as a stateful workspace.
93
- - **`/writing-for-agents`** is the reference for writing documents agents consume: skills, AGENTS.md, pointed-at docs.
94
-
95
- ## Precondition
96
-
97
- **`/setup-matt-pocock-skills`**: run before your first engineering flow to configure the issue tracker, triage labels, and doc layout the other skills assume. Custom issue trackers also work.
@@ -1,5 +0,0 @@
1
- interface:
2
- display_name: "Ask Matt"
3
- short_description: "Find the right skill or workflow"
4
- policy:
5
- allow_implicit_invocation: false
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Matt Pocock
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,89 +0,0 @@
1
- ---
2
- name: code-review
3
- description: "Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to \"review since X\"."
4
- ---
5
-
6
- Two-axis review of the diff between `HEAD` and a fixed point the user supplies:
7
-
8
- - **Standards**: does the code conform to this repo's documented coding standards?
9
- - **Spec**: does the code faithfully implement the originating issue / spec?
10
-
11
- Both axes run as **parallel sub-agents** so they don't pollute each other's context, then this skill aggregates their findings.
12
-
13
- The issue tracker should have been provided to you. If not, tell the user to run `/setup-matt-pocock-skills`.
14
-
15
- ## Process
16
-
17
- ### 1. Pin the fixed point
18
-
19
- Whatever the user said is the fixed point (a commit SHA, branch name, tag, `main`, `HEAD~5`, etc.). If they didn't specify one, ask for it.
20
-
21
- Capture the diff command once: `git diff <fixed-point>...HEAD` (three-dot, so the comparison is against the merge-base). Also note the list of commits via `git log <fixed-point>..HEAD --oneline`.
22
-
23
- Before going further, confirm the fixed point resolves (`git rev-parse <fixed-point>`) and the diff is non-empty. A bad ref or empty diff should fail here, not inside two parallel sub-agents.
24
-
25
- ### 2. Identify the spec source
26
-
27
- Look for the originating spec, in this order:
28
-
29
- 1. Issue references in the commit messages (`#123`, `Closes #45`, GitLab `!67`, etc.), fetched via the workflow in the tracker doc.
30
- 2. A path the user passed as an argument.
31
- 3. A spec file under `docs/`, `specs/`, or `.scratch/` matching the branch name or feature.
32
- 4. If nothing is found, ask the user where the spec is. If they say there isn't one, the **Spec** sub-agent will skip and report "no spec available".
33
-
34
- ### 3. Identify the standards sources
35
-
36
- Search the repo for every file that documents how code should be written. When `CODING_STANDARDS.md` or `CONTRIBUTING.md` exists, it must be on the list.
37
-
38
- On top of whatever the repo documents, the Standards axis always carries the **smell baseline** below: a fixed set of Fowler code smells (_Refactoring_, ch.3) that applies even when a repo documents nothing. Two rules bind it:
39
-
40
- - **The repo overrides.** A documented repo standard always wins; where it endorses something the baseline would flag, suppress the smell.
41
- - **Always a judgement call.** Each smell is a labelled heuristic ("possible Feature Envy"), never a hard violation. Like any standard here, skip anything tooling already enforces.
42
-
43
- Each smell reads *what it is* → *how to fix*; match it against the diff:
44
-
45
- - **Mysterious Name**: a function, variable, or type whose name doesn't reveal what it does or holds. → rename it; if no honest name comes, the design's murky.
46
- - **Duplicated Code**: the same logic shape appears in more than one hunk or file in the change. → extract the shared shape, call it from both.
47
- - **Feature Envy**: a method that reaches into another object's data more than its own. → move the method onto the data it envies.
48
- - **Data Clumps**: the same few fields or params keep travelling together (a type wanting to be born). → bundle them into one type, pass that.
49
- - **Primitive Obsession**: a primitive or string standing in for a domain concept that deserves its own type. → give the concept its own small type.
50
- - **Repeated Switches**: the same `switch`/`if`-cascade on the same type recurs across the change. → replace with polymorphism, or one map both sites share.
51
- - **Shotgun Surgery**: one logical change forces scattered edits across many files in the diff. → gather what changes together into one module.
52
- - **Divergent Change**: one file or module is edited for several unrelated reasons. → split so each module changes for one reason.
53
- - **Speculative Generality**: abstraction, parameters, or hooks added for needs the spec doesn't have. → delete it; inline back until a real need shows.
54
- - **Message Chains**: long `a.b().c().d()` navigation the caller shouldn't depend on. → hide the walk behind one method on the first object.
55
- - **Middle Man**: a class or function that mostly just delegates onward. → cut it, call the real target direct.
56
- - **Refused Bequest**: a subclass or implementer that ignores or overrides most of what it inherits. → drop the inheritance, use composition.
57
-
58
- ### 4. Spawn both sub-agents in parallel
59
-
60
- Issue both sub-agent calls together, in the foreground, and aggregate the reports they return.
61
-
62
- **Standards sub-agent prompt** should include:
63
-
64
- - The full diff command and commit list.
65
- - The list of standards-source files you found in step 3, **plus the smell baseline from step 3** pasted in full (the sub-agent has no other access to it).
66
- - The brief: "Report, per file/hunk where relevant, (a) every place the diff violates a documented standard: cite the standard (file + the rule); and (b) any baseline smell you spot: name it and quote the hunk. Distinguish hard violations from judgement calls: documented-standard breaches can be hard, but baseline smells are always judgement calls, and a documented repo standard overrides the baseline. Skip anything tooling enforces. Under 400 words."
67
-
68
- **Spec sub-agent prompt** should include:
69
-
70
- - The diff command and commit list.
71
- - The path or fetched contents of the spec.
72
- - The brief: "Report: (a) requirements the spec asked for that are missing or partial; (b) behaviour in the diff that wasn't asked for (scope creep); (c) requirements that look implemented but where the implementation looks wrong. Quote the spec line for each finding. Under 400 words."
73
-
74
- If the spec is missing, skip the Spec sub-agent and note this in the final report.
75
-
76
- ### 5. Aggregate
77
-
78
- Present the two reports under `## Standards` and `## Spec` headings, verbatim or lightly cleaned. Do **not** merge or rerank findings, because the two axes are deliberately separate (see _Why two axes_).
79
-
80
- End with a one-line summary: total findings per axis, and the worst issue _within each axis_ (if any). Don't pick a single winner across axes: that's the reranking the separation exists to prevent.
81
-
82
- ## Why two axes
83
-
84
- A change can pass one axis and fail the other:
85
-
86
- - Code that follows every standard but implements the wrong thing → **Standards pass, Spec fail.**
87
- - Code that does exactly what the issue asked but breaks the project's conventions → **Spec pass, Standards fail.**
88
-
89
- Reporting them separately stops one axis from masking the other.
@@ -1,3 +0,0 @@
1
- interface:
2
- display_name: "Code Review"
3
- short_description: "Review a diff on standards and spec"