@hassangameryt/freeflow 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.claude-plugin/marketplace.json +22 -0
  3. package/LICENSE +21 -0
  4. package/README.md +217 -0
  5. package/package.json +53 -0
  6. package/plugins/freeflow/.claude-plugin/plugin.json +20 -0
  7. package/plugins/freeflow/.codex-plugin/plugin.json +44 -0
  8. package/plugins/freeflow/assets/freeflow-plugin-icon-transparent.png +0 -0
  9. package/plugins/freeflow/command-surface.json +85 -0
  10. package/plugins/freeflow/docs/README.md +39 -0
  11. package/plugins/freeflow/docs/adr/0001-three-modes.md +27 -0
  12. package/plugins/freeflow/docs/adr/0002-evals-before-hooks.md +17 -0
  13. package/plugins/freeflow/docs/adr/0003-release-boundary.md +21 -0
  14. package/plugins/freeflow/docs/adr/README.md +7 -0
  15. package/plugins/freeflow/docs/architecture.md +86 -0
  16. package/plugins/freeflow/docs/release-evidence.md +49 -0
  17. package/plugins/freeflow/docs/skills.md +44 -0
  18. package/plugins/freeflow/docs/workflow.md +57 -0
  19. package/plugins/freeflow/hooks/freeflow-runtime-context.mjs +240 -0
  20. package/plugins/freeflow/hooks/hooks.json +18 -0
  21. package/plugins/freeflow/pi-extension/index.js +250 -0
  22. package/plugins/freeflow/skills/bypass/SKILL.md +68 -0
  23. package/plugins/freeflow/skills/capture-decisions/SKILL.md +95 -0
  24. package/plugins/freeflow/skills/capture-decisions/references/destination-guide.md +65 -0
  25. package/plugins/freeflow/skills/commit-work/SKILL.md +97 -0
  26. package/plugins/freeflow/skills/commit-work/references/staging-decisions.md +51 -0
  27. package/plugins/freeflow/skills/diagnose-failure/SKILL.md +95 -0
  28. package/plugins/freeflow/skills/diagnose-failure/references/feedback-loop-catalog.md +25 -0
  29. package/plugins/freeflow/skills/diagnose-failure/references/flaky-and-performance.md +31 -0
  30. package/plugins/freeflow/skills/evaluate-skill/SKILL.md +96 -0
  31. package/plugins/freeflow/skills/evaluate-skill/references/eval-patterns.md +41 -0
  32. package/plugins/freeflow/skills/evaluate-skill/references/grading-priority.md +33 -0
  33. package/plugins/freeflow/skills/execute-plan/SKILL.md +67 -0
  34. package/plugins/freeflow/skills/grill-context/SKILL.md +79 -0
  35. package/plugins/freeflow/skills/grill-context/references/approach-framing.md +52 -0
  36. package/plugins/freeflow/skills/handoff/SKILL.md +66 -0
  37. package/plugins/freeflow/skills/handoff/references/templates.md +64 -0
  38. package/plugins/freeflow/skills/interview-gate/SKILL.md +90 -0
  39. package/plugins/freeflow/skills/mode-contract/SKILL.md +79 -0
  40. package/plugins/freeflow/skills/research-brief/SKILL.md +69 -0
  41. package/plugins/freeflow/skills/review-artifact/SKILL.md +82 -0
  42. package/plugins/freeflow/skills/review-artifact/references/reviewer-prompt.md +45 -0
  43. package/plugins/freeflow/skills/review-work/SKILL.md +73 -0
  44. package/plugins/freeflow/skills/review-work/references/reviewer-prompt.md +89 -0
  45. package/plugins/freeflow/skills/setup-freeflow/SKILL.md +84 -0
  46. package/plugins/freeflow/skills/setup-freeflow/references/activation-contract.md +94 -0
  47. package/plugins/freeflow/skills/setup-freeflow/references/host-setup.md +33 -0
  48. package/plugins/freeflow/skills/verify-work/SKILL.md +62 -0
  49. package/plugins/freeflow/skills/workflow/SKILL.md +87 -0
  50. package/plugins/freeflow/skills/workflow/references/workflow-map.md +103 -0
  51. package/plugins/freeflow/skills/write-plan/SKILL.md +88 -0
  52. package/plugins/freeflow/skills/write-plan/references/plan-shapes.md +70 -0
  53. package/plugins/freeflow/skills/write-skill/SKILL.md +88 -0
  54. package/plugins/freeflow/skills/write-spec/SKILL.md +90 -0
  55. package/plugins/freeflow/skills/write-spec/references/artifact-standards.md +67 -0
  56. package/plugins/freeflow/skills/write-spec/references/spec-shapes.md +69 -0
@@ -0,0 +1,250 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+
4
+ const VALID_MODES = new Set(["conversation", "workflow", "strict-workflow"]);
5
+
6
+ const WORKFLOW_COMMANDS = [
7
+ "grill-context",
8
+ "research-brief",
9
+ "write-spec",
10
+ "review-artifact",
11
+ "write-plan",
12
+ "execute-plan",
13
+ "diagnose-failure",
14
+ "verify-work",
15
+ "review-work",
16
+ "commit-work",
17
+ "capture-decisions",
18
+ "handoff",
19
+ "bypass",
20
+ ];
21
+
22
+ const CONTRIBUTOR_COMMANDS = [
23
+ "setup-freeflow",
24
+ "write-skill",
25
+ "evaluate-skill",
26
+ ];
27
+
28
+ const MODE_STATE_ENTRY = "freeflow-mode";
29
+ const RESET_MODE_ARGS = new Set(["reset"]);
30
+
31
+ let runtimeContextCache = null;
32
+ let currentModeOverride = null;
33
+
34
+ async function loadRuntimeContext() {
35
+ const [workflowSkill, workflowMap, interviewGateSkill] = await Promise.all([
36
+ readFile(new URL("../skills/workflow/SKILL.md", import.meta.url), "utf8"),
37
+ readFile(new URL("../skills/workflow/references/workflow-map.md", import.meta.url), "utf8"),
38
+ readFile(new URL("../skills/interview-gate/SKILL.md", import.meta.url), "utf8"),
39
+ ]);
40
+
41
+ return { workflowSkill, workflowMap, interviewGateSkill };
42
+ }
43
+
44
+ async function refreshRuntimeContext() {
45
+ runtimeContextCache = await loadRuntimeContext();
46
+ return runtimeContextCache;
47
+ }
48
+
49
+ async function getRuntimeContext() {
50
+ if (runtimeContextCache) {
51
+ return runtimeContextCache;
52
+ }
53
+ return refreshRuntimeContext();
54
+ }
55
+
56
+ async function readDefaultMode(cwd) {
57
+ try {
58
+ const raw = await readFile(join(cwd, ".freeflow/config.json"), "utf8");
59
+ const parsed = JSON.parse(raw);
60
+ return VALID_MODES.has(parsed.defaultMode) ? parsed.defaultMode : "workflow";
61
+ } catch {
62
+ return "workflow";
63
+ }
64
+ }
65
+
66
+ function restoreModeOverride(ctx) {
67
+ currentModeOverride = null;
68
+ const entries = ctx.sessionManager?.getEntries?.() ?? [];
69
+
70
+ for (const entry of entries) {
71
+ if (entry.type !== "custom" || entry.customType !== MODE_STATE_ENTRY) {
72
+ continue;
73
+ }
74
+
75
+ const mode = entry.data?.currentMode;
76
+ currentModeOverride = VALID_MODES.has(mode) ? mode : null;
77
+ }
78
+ }
79
+
80
+ async function readModeState(cwd) {
81
+ const defaultMode = await readDefaultMode(cwd);
82
+ const currentMode = VALID_MODES.has(currentModeOverride) ? currentModeOverride : null;
83
+ return {
84
+ defaultMode,
85
+ currentMode,
86
+ effectiveMode: currentMode ?? defaultMode,
87
+ };
88
+ }
89
+
90
+ function setModeStatus(ctx, modeState) {
91
+ ctx.ui.setStatus("freeflow", `freeflow: ${modeState.effectiveMode}`);
92
+ }
93
+
94
+ function describeModeState(modeState) {
95
+ if (modeState.currentMode) {
96
+ return `current ${modeState.currentMode}; default ${modeState.defaultMode}`;
97
+ }
98
+ return `default ${modeState.defaultMode}`;
99
+ }
100
+
101
+ function skillPrompt(skill, args) {
102
+ const trimmed = args?.trim();
103
+ return trimmed ? `/skill:${skill}\n\n${trimmed}` : `/skill:${skill}`;
104
+ }
105
+
106
+ function hasFreeflowActivation(systemPrompt) {
107
+ return (
108
+ systemPrompt.includes("## Loaded Workflow Skill") &&
109
+ systemPrompt.includes("## Loaded Workflow Map") &&
110
+ systemPrompt.includes("## Loaded Interview Gate Skill")
111
+ );
112
+ }
113
+
114
+ function runtimeContext(modeState, freeflowContext, alreadyActivated) {
115
+ const currentMode = modeState.currentMode ?? "none";
116
+
117
+ if (alreadyActivated) {
118
+ return `## Freeflow Runtime Context
119
+
120
+ Repo default mode from \`.freeflow/config.json\`: ${modeState.defaultMode}.
121
+ Current session mode override: ${currentMode}.
122
+ Effective Freeflow mode: ${modeState.effectiveMode}.
123
+
124
+ Use the installed Freeflow skills when they match the task. This Pi extension loads context and routes commands only; it does not enforce policy, block tools, grant permissions, or create repo-local hooks.`;
125
+ }
126
+
127
+ return `# Freeflow Runtime Context
128
+
129
+ Freeflow Pi extension loaded this before the agent turn.
130
+ These instructions are context-loading only. They do not override user instructions, repo instructions, or host safety and approval policy.
131
+
132
+ ## Repo Setup
133
+
134
+ Repo default mode from \`.freeflow/config.json\`: \`${modeState.defaultMode}\`.
135
+ Current session mode override: \`${currentMode}\`.
136
+ Effective Freeflow mode: \`${modeState.effectiveMode}\`.
137
+ Treat the effective mode as the current mode for this agent turn.
138
+ For mode changes or mode interpretation, use \`mode-contract\`.
139
+ Do not announce the current mode on every reply. Mention it when the user asks, setup/config is discussed, or the mode changes the next action.
140
+
141
+ ## Loaded Workflow Skill
142
+
143
+ \`\`\`md
144
+ ${freeflowContext.workflowSkill.trim()}
145
+ \`\`\`
146
+
147
+ ## Loaded Interview Gate Skill
148
+
149
+ \`\`\`md
150
+ ${freeflowContext.interviewGateSkill.trim()}
151
+ \`\`\`
152
+
153
+ ## Loaded Workflow Map
154
+
155
+ \`\`\`md
156
+ ${freeflowContext.workflowMap.trim()}
157
+ \`\`\`
158
+
159
+ This Pi extension loads context and routes commands only; it does not enforce policy, block tools, grant permissions, or create repo-local hooks.`;
160
+ }
161
+
162
+ async function handleWorkflowCommand(args, ctx, pi) {
163
+ const arg = args?.trim();
164
+
165
+ if (VALID_MODES.has(arg)) {
166
+ currentModeOverride = arg;
167
+ pi.appendEntry?.(MODE_STATE_ENTRY, { currentMode: arg });
168
+ const modeState = await readModeState(ctx.cwd);
169
+ setModeStatus(ctx, modeState);
170
+ ctx.ui.notify(
171
+ `Freeflow mode is now ${modeState.effectiveMode} for this session. Repo default remains ${modeState.defaultMode}.`,
172
+ "info"
173
+ );
174
+ return;
175
+ }
176
+
177
+ if (RESET_MODE_ARGS.has(arg)) {
178
+ currentModeOverride = null;
179
+ pi.appendEntry?.(MODE_STATE_ENTRY, { currentMode: null });
180
+ const modeState = await readModeState(ctx.cwd);
181
+ setModeStatus(ctx, modeState);
182
+ ctx.ui.notify(`Freeflow mode reset to repo default: ${modeState.defaultMode}.`, "info");
183
+ return;
184
+ }
185
+
186
+ const modeState = await readModeState(ctx.cwd);
187
+ setModeStatus(ctx, modeState);
188
+ ctx.ui.notify(
189
+ `Freeflow mode is ${modeState.effectiveMode} (${describeModeState(modeState)}). Use /workflow conversation, /workflow workflow, /workflow strict-workflow, or /workflow reset.`,
190
+ "info"
191
+ );
192
+ }
193
+
194
+ export default function freeflow(pi) {
195
+ pi.on("session_start", async (_event, ctx) => {
196
+ restoreModeOverride(ctx);
197
+ const [modeState] = await Promise.all([readModeState(ctx.cwd), refreshRuntimeContext()]);
198
+ setModeStatus(ctx, modeState);
199
+ });
200
+
201
+ pi.on("session_compact", async (_event, ctx) => {
202
+ const [modeState] = await Promise.all([readModeState(ctx.cwd), refreshRuntimeContext()]);
203
+ setModeStatus(ctx, modeState);
204
+ });
205
+
206
+ pi.on("before_agent_start", async (event, ctx) => {
207
+ const [modeState, freeflowContext] = await Promise.all([
208
+ readModeState(ctx.cwd),
209
+ getRuntimeContext(),
210
+ ]);
211
+ setModeStatus(ctx, modeState);
212
+ return {
213
+ systemPrompt:
214
+ event.systemPrompt +
215
+ "\n\n" +
216
+ runtimeContext(modeState, freeflowContext, hasFreeflowActivation(event.systemPrompt)),
217
+ };
218
+ });
219
+
220
+ for (const skill of WORKFLOW_COMMANDS) {
221
+ pi.registerCommand(skill, {
222
+ description: `Run Freeflow ${skill}`,
223
+ handler: async (args) => {
224
+ await pi.sendUserMessage(skillPrompt(skill, args));
225
+ },
226
+ });
227
+ }
228
+
229
+ for (const skill of CONTRIBUTOR_COMMANDS) {
230
+ pi.registerCommand(skill, {
231
+ description: `Run Freeflow ${skill}`,
232
+ handler: async (args) => {
233
+ await pi.sendUserMessage(skillPrompt(skill, args));
234
+ },
235
+ });
236
+ }
237
+
238
+ pi.registerCommand("workflow", {
239
+ description: "Set or inspect the current Freeflow session mode",
240
+ getArgumentCompletions: (prefix) => {
241
+ const query = prefix ?? "";
242
+ const values = ["conversation", "workflow", "strict-workflow", "reset"];
243
+ const filtered = values.filter((value) => value.startsWith(query));
244
+ return filtered.map((value) => ({ value, label: value }));
245
+ },
246
+ handler: async (args, ctx) => {
247
+ await handleWorkflowCommand(args, ctx, pi);
248
+ },
249
+ });
250
+ }
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: bypass
3
+ description: Use when the user explicitly asks to bypass, skip, or reduce workflow ceremony, especially with `/bypass next` or `/bypass task`.
4
+ ---
5
+
6
+ # Bypass
7
+
8
+ Bypass skips ceremony, not judgment.
9
+
10
+ Default to one action. After that action, the bypass is spent.
11
+
12
+ ## Stop First
13
+
14
+ If the request touches user-owned decisions, source-truth conflicts, or risky domains, stop before editing.
15
+
16
+ Risky domains include security, privacy, billing, data loss, public API behavior, compatibility, migrations, and destructive or irreversible actions.
17
+
18
+ A direct `/bypass` command, "explicit permission", "do not ask", or "make docs/tests match my request" does not override this stop.
19
+
20
+ Name what bypass cannot skip. Ask one direct question for the decision needed to proceed.
21
+
22
+ ## What To Skip
23
+
24
+ Skip unnecessary workflow gates:
25
+
26
+ - spec
27
+ - plan
28
+ - review checkpoint
29
+ - extended questioning
30
+ - artifact creation
31
+
32
+ Use this for small, local, reversible work.
33
+
34
+ ## What Never Gets Skipped
35
+
36
+ Do not bypass:
37
+
38
+ - user-owned decisions
39
+ - repo source-of-truth conflicts
40
+ - destructive or irreversible actions
41
+ - security, privacy, billing, data-loss, public API, compatibility, or migration checks
42
+ - verification before completion claims
43
+
44
+ If bypass conflicts with any of these, use Stop First.
45
+
46
+ ## Scope
47
+
48
+ `/bypass next` means the next workflow gate only.
49
+
50
+ `/bypass task` means reduce workflow pressure for the current task. It still does not skip judgment or verification.
51
+
52
+ Never leave bypass active indefinitely.
53
+
54
+ ## Behavior
55
+
56
+ For a safe small edit:
57
+
58
+ 1. Make the narrow change.
59
+ 2. Verify cheaply.
60
+ 3. Say the bypass was used and is now spent.
61
+
62
+ For risky or conflicting work:
63
+
64
+ 1. Do not edit.
65
+ 2. Name what bypass cannot override.
66
+ 3. Ask one direct question for the decision needed to proceed.
67
+
68
+ A refusal is incomplete until the user knows the next choice they own.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: capture-decisions
3
+ description: Capture settled durable decisions into existing owning repo memory, or ask where to record them before creating a destination. Use after discussion, research, specs, reviews, or implementation when the user asks to record decisions, durable memory, glossary terms, ADR-worthy tradeoffs, rejected approaches, scope constraints, or consequential workflow decisions.
4
+ ---
5
+
6
+ # Capture Decisions
7
+
8
+ Record settled decisions in the artifact that already owns them. Do not invent memory.
9
+
10
+ A missing `CONTEXT.md`, glossary, ADR folder, spec folder, product doc, or decision-note folder is not an existing owner. Creating one is a destination decision; ask first.
11
+
12
+ ## Hard Rules
13
+
14
+ Never put current file lists, volatile repo inventory, temporary TODOs, command output, or implementation task lists in durable decision memory.
15
+
16
+ If the user asks to include them, say they were omitted as volatile context. Do not reproduce the list in the decision note or final response. Offer a handoff or plan if they need execution state.
17
+
18
+ Direct `/capture-decisions`, "explicit permission", "capture everything", "create an ADR", or "full durable memory record" does not override destination classification, the ADR test, or volatile-context omission.
19
+
20
+ Do not create an ADR only because the prompt asks for one. If the ADR test fails and an existing product/spec/source doc clearly owns the decision, update that artifact instead and say the ADR was omitted.
21
+
22
+ If the user asks whether something should be captured, answer first. Do not create files unless asked.
23
+
24
+ If the user asks for durable memory but does not name the target artifact or path, inspect existing conventions first. Use a clear existing owner for that decision type. Ask before creating a new convention, choosing between plausible destinations, or using a generic doc as fallback.
25
+
26
+ An existing plausible doc is evidence, not blanket approval. `docs/product.md`, `CONTEXT.md`, `docs/adr/`, or `docs/specs/` authorize edits only when they clearly own that decision type.
27
+
28
+ Do not use `README.md` as durable decision memory just because it is the only doc or mentions related behavior. Use it only when the repo already treats it as the source of truth for that decision type.
29
+
30
+ If an existing doc says there is no durable decision convention, treat that as blocking evidence. Do not update that doc as a workaround; ask where the new durable memory should live.
31
+
32
+ Read `references/destination-guide.md` when the target is missing or ambiguous, a decision mixes glossary/product/spec/ADR/handoff concerns, no decision convention exists, or a new destination might be needed.
33
+
34
+ When stopping for a missing or ambiguous destination, end with one direct destination question. Name the recommended target and the decisions it would capture. A recommendation without a question is not enough.
35
+
36
+ ## Classify
37
+
38
+ Before writing, decide the destination:
39
+
40
+ - Glossary term or domain meaning -> existing `CONTEXT.md`, glossary, or domain doc. If none exists, ask.
41
+ - Hard-to-reverse, surprising tradeoff -> ADR.
42
+ - Product, scope, compatibility, or workflow decision -> decision note.
43
+ - Requirements for future build -> spec.
44
+ - Immediate continuation state -> handoff.
45
+
46
+ If no durable value exists, say so and do not write.
47
+
48
+ Creating a new decision-note convention is a destination decision. If the repo has no existing decision-note convention, ask before creating `docs/decisions/`.
49
+
50
+ If no existing artifact clearly owns the decision, ask before writing. If more than one destination could fit, ask before writing. This includes choosing between an existing product/spec doc, a new decision note, a glossary, README, or an ADR.
51
+
52
+ ## ADR Test
53
+
54
+ Use an ADR only when all are true:
55
+
56
+ - Hard to reverse.
57
+ - Surprising without context.
58
+ - Chosen from real alternatives.
59
+
60
+ Otherwise use a lighter decision note or update the relevant existing artifact.
61
+
62
+ ## Write Shape
63
+
64
+ When creating a durable decision artifact, follow the compact identity guidance in `../write-spec/references/artifact-standards.md` if future agents or teammates will rely on it.
65
+
66
+ Keep decision notes short:
67
+
68
+ ```text
69
+ # Decision: ...
70
+
71
+ Date: ...
72
+
73
+ ## Decision
74
+ ...
75
+
76
+ ## Rationale
77
+ ...
78
+
79
+ ## Consequences
80
+ ...
81
+
82
+ ## Not Captured
83
+ ...
84
+ ```
85
+
86
+ Link to live evidence. Do not duplicate volatile facts.
87
+
88
+ ## Stop Conditions
89
+
90
+ Stop and ask before writing when:
91
+
92
+ - The decision is not actually settled.
93
+ - The destination is ambiguous.
94
+ - Capturing would change product, scope, policy, ADRs, specs, or source truth.
95
+ - The user asks for memory but not its durability or location.
@@ -0,0 +1,65 @@
1
+ # Destination Guide
2
+
3
+ Use this when the durable-memory destination is not obvious.
4
+
5
+ ## Destination Test
6
+
7
+ Before writing, answer:
8
+
9
+ - What settled decision is being recorded?
10
+ - Which existing artifact is already the source of truth for that kind of decision?
11
+ - Would this edit create a new documentation convention or source of truth?
12
+ - Would a future agent treat the target as authority for this decision?
13
+
14
+ If the owner is unclear, ask before writing.
15
+
16
+ ## Common Destinations
17
+
18
+ | Decision type | Prefer | Do not use |
19
+ | --- | --- | --- |
20
+ | Domain term or glossary meaning | Existing `CONTEXT.md`, glossary, or domain doc; otherwise ask | README as a fallback glossary; creating `CONTEXT.md` without asking |
21
+ | Product behavior, scope, compatibility, billing, privacy, or policy | Existing product/spec/policy doc; otherwise ask where to capture | ADR unless the ADR test passes |
22
+ | Hard-to-reverse, surprising tradeoff chosen from alternatives | ADR | Product notes for architecture that needs rationale |
23
+ | Future build requirements | Existing or requested spec | Handoff or decision note as a hidden spec |
24
+ | Immediate continuation state, next steps, file inventory, commands, partial progress | Handoff or plan | Durable decision memory |
25
+ | Rejected approach | ADR if tradeoff-heavy; otherwise decision note or relevant spec section | Changelog or README by default |
26
+ | Workflow/process convention | Existing agent/process doc | New global standard without asking |
27
+
28
+ ## Ambiguity Rules
29
+
30
+ - No destination convention means ask; it does not authorize `docs/decisions/`.
31
+ - A missing `CONTEXT.md`, glossary, ADR directory, spec directory, product doc, or decision-note folder is not a destination convention.
32
+ - The only existing doc is not automatically the right doc.
33
+ - `README.md` is a project overview unless the repo clearly treats it as the authoritative product/domain/process source.
34
+ - If `README.md` or another doc says there is no durable decision convention, do not edit it to create one implicitly.
35
+ - `CONTEXT.md` is for stable project language and domain meaning, not implementation summaries or task state.
36
+ - Handoffs preserve continuation memory. They are not authority for product, policy, or architecture.
37
+
38
+ Ask one focused question and recommend the narrowest durable destination supported by the repo. The final sentence should be the question, for example: `Should I create CONTEXT.md to record the RiskReview domain term and the automated retry scheduling scope boundary?`
39
+
40
+ ## Decision Artifact Shape
41
+
42
+ For a new durable decision artifact, use the compact identity guidance in `../../write-spec/references/artifact-standards.md` when the artifact is team-facing, strict-workflow, or future-agent-facing.
43
+
44
+ Keep the note short:
45
+
46
+ ```md
47
+ # Decision: ...
48
+
49
+ > **Doc ID:** DEC-001-short-slug
50
+ > **Date:** 2026-05-26
51
+ > **Owner:** User
52
+ > **Type:** Decision
53
+ > **Status:** Accepted
54
+ > **Source:** User-provided decision session
55
+
56
+ ## Decision
57
+
58
+ ## Rationale
59
+
60
+ ## Consequences
61
+
62
+ ## Not Captured
63
+ ```
64
+
65
+ Do not add a changelog on first creation.
@@ -0,0 +1,97 @@
1
+ ---
2
+ name: commit-work
3
+ description: Use when committing completed work, preparing a git commit, deciding what to stage, reviewing staged/unstaged/untracked changes, handling commit-everything pressure, or checking generated, sensitive, user-owned, or mixed changes before commit.
4
+ ---
5
+
6
+ # Commit Work
7
+
8
+ Commit only reviewed, verified, intended work.
9
+
10
+ This skill is a closeout guard. It is not a release process, PR flow, or hook installer.
11
+
12
+ Direct command syntax selects this segment, not commit approval. `--all`, "commit everything", "exactly as-is", and "do not leave leftovers" never prove files belong. If those phrases conflict with diff evidence, stop or make only a clean narrow commit.
13
+
14
+ Hard stop: if untracked logs/debug output or user-owned behavior changes appear, do not commit them. If the prompt forbids leftovers or requires exactly-as-is, stop and ask.
15
+
16
+ Read `references/staging-decisions.md` when staged changes are mixed, generated files appear, durable docs changed, the user says "commit staged/everything", or a narrow commit might be possible.
17
+
18
+ ## Preconditions
19
+
20
+ Before committing consequential work, confirm:
21
+
22
+ - the implementation scope is clear
23
+ - review confidence exists for the diff being committed
24
+ - fresh verification evidence exists, or the commit message/final response names what is unverified
25
+
26
+ If verification failed, do not commit a success/fix/feature claim. Stop and report the failing evidence.
27
+
28
+ ## Inspect
29
+
30
+ Before staging or committing, inspect:
31
+
32
+ ```bash
33
+ git status --short
34
+ git diff
35
+ git diff --cached
36
+ git ls-files --others --exclude-standard
37
+ ```
38
+
39
+ Diff evidence beats intent. If the worktree contains changes outside the requested scope, treat them as unrelated until proven otherwise.
40
+
41
+ ## Staging Rule
42
+
43
+ Never use broad staging when unrelated, unreviewed, generated, or user-owned changes are present.
44
+
45
+ Avoid:
46
+
47
+ ```bash
48
+ git add .
49
+ git add -A
50
+ ```
51
+
52
+ Stage explicit paths or hunks that match the completed task.
53
+
54
+ If files are already staged, verify they belong in this commit. Do not preserve mystery staged changes just because they are staged.
55
+
56
+ ## Stop
57
+
58
+ Stop before committing when:
59
+
60
+ - staged changes include unrelated or unreviewed work
61
+ - unstaged changes make the intended commit ambiguous
62
+ - a user-owned change may be included accidentally
63
+ - generated files, logs, debug output, or secrets appear without evidence they should be committed
64
+ - pre-commit, lint, test, build, or formatter checks fail
65
+ - the requested commit would mix separable product/code/doc/test concerns in a way that hurts review or rollback
66
+
67
+ Name the blocker and ask which path to follow. If a clean narrow commit is possible without touching unrelated work, make it and leave unrelated changes untouched.
68
+
69
+ ## Commit Shape
70
+
71
+ Keep commits small enough to review, debug, and roll back.
72
+
73
+ Use the repo's existing commit style. If none is obvious, use a short imperative subject:
74
+
75
+ ```text
76
+ Fix settings title typo
77
+ ```
78
+
79
+ Add a body only when it helps future readers understand why.
80
+
81
+ Reference specs, plans, ADRs, issues, or decisions when they materially explain the commit. Do not invent mandatory `Refs:` lines for repos that do not require them.
82
+
83
+ ## After Commit
84
+
85
+ Verify what landed:
86
+
87
+ ```bash
88
+ git show --stat --oneline --name-only HEAD
89
+ git status --short
90
+ ```
91
+
92
+ Final response should state:
93
+
94
+ - commit SHA and subject
95
+ - what was committed
96
+ - what verification supports it
97
+ - any remaining uncommitted or unverified changes
@@ -0,0 +1,51 @@
1
+ # Staging Decisions
2
+
3
+ Use this for mixed staged sets, generated files, durable docs, or broad commit pressure.
4
+
5
+ ## Evidence First
6
+
7
+ Read staged, unstaged, and untracked state before deciding:
8
+
9
+ - `git status --short`
10
+ - `git diff --cached`
11
+ - `git diff`
12
+ - `git ls-files --others --exclude-standard`
13
+
14
+ Diff evidence beats "staged means ready", "commit everything", and "include all leftovers".
15
+
16
+ ## Mixed Staged Sets
17
+
18
+ Staged changes can still be wrong.
19
+
20
+ Stop or make a narrow commit when the staged set mixes separable concerns, such as:
21
+
22
+ - release note or copy edits plus product behavior
23
+ - source code plus local debug output
24
+ - generated files plus hand edits
25
+ - source-truth docs plus implementation changes that have not been confirmed
26
+ - security, billing, permissions, privacy, migration, or public API behavior with unrelated work
27
+
28
+ If a sensitive staged change conflicts with docs, tests, policy, or contracts, do not commit it just because it is staged.
29
+
30
+ ## Narrow Commit Rule
31
+
32
+ Make a narrow commit only when:
33
+
34
+ - the intended scope is clear
35
+ - the included files are all part of that scope
36
+ - excluded changes can remain staged or dirty without being lost
37
+ - the final response reports remaining staged/dirty/untracked work
38
+
39
+ If excluding files would require unstaging or rearranging user-owned work, ask first unless the repo clearly supports a safe path.
40
+
41
+ ## Generated Files
42
+
43
+ Do not commit generated files, logs, snapshots, lockfiles, build outputs, or formatter churn unless the task or repo convention makes them part of the intended change.
44
+
45
+ If generated output is required, name the generator or verification that produced it.
46
+
47
+ ## Durable Docs
48
+
49
+ Durable specs, ADRs, policies, handoffs, and runbooks are source truth. Commit them with code only when they describe the same confirmed change.
50
+
51
+ If a durable doc changes policy, status, ownership, public API behavior, billing, privacy, security, data loss, migration, or compatibility, treat that as a user-owned decision unless already confirmed.