Skip to content

Add /flow-card: author a card's completion contract before triage - #9

Open
dinershtein wants to merge 3 commits into
mainfrom
flow-card
Open

Add /flow-card: author a card's completion contract before triage#9
dinershtein wants to merge 3 commits into
mainfrom
flow-card

Conversation

@dinershtein

Copy link
Copy Markdown
Contributor

What failure mode this closes

A rough card is underspecified in exactly the ways triage detects and cannot fix alone, so it pays a three-command round-trip: /flow-check[meta] QUESTIONSHuman Questions/flow-questionsBacklog/flow-check again. The questions are the same either way; the human just answers them hours later, without the context that made the intention obvious when they typed it.

/flow-card <rough intention> moves that Q&A to authoring time:

  1. Ground the sentence in the repo (files must exist now; matching learnings.jsonl pitfalls are read).
  2. Sort the eight card-eval.md gap categories through the same auto-answer policy triage uses — safe defaults become [meta] ASSUMED comments, only What / Why / Dependencies / split-implying Size reach the human.
  3. At most three AskUserQuestion turns, each with a Park in Icebox escape.
  4. Show the composed card in full and gate create_item behind a Create it / Revise / Discard approval.
  5. Create one Backlog card carrying a completion contract: ## Goal, ## Why, ## Done when, ## Out of scope, ## Stop if, ## Context.

Deliberate limits

  • Not a second planner. No approach, no file manifest, no test commands — the WHAT/HOW split and the human's plan-approval gate are untouched.
  • Exactly one card per invocation. An intention worth several PRs is narrowed to its first shippable slice, the rest parked in Icebox. /flow-check's SPLIT path stays the single tested splitter.
  • The three-turn cap can overflow. A card may still reach triage with an open question — it lands as a ## Stop if bullet and the existing QUESTIONS route handles it.
  • Optional. A hand-written card behaves exactly as before.

No new config keys (config-contract.txt untouched), no new states, no changes to any existing prompt. create_item / update_title are already required provider ops, so Trello and GitHub both work; native_ids: yes suppresses the [PREFIX-N] title prefix automatically.

Prior art

The contract shape (end state / proof / boundaries / loop / stop rule), "define proof, not effort", show-the-exact-text-before-starting, and the "a prose menu of options is a defect — use AskUserQuestion" rule are adapted from MoonshotAI/kimi-code's builtin write-goal skill (MIT). Re-implemented against this kit's card/PLAN architecture — nothing copied verbatim, and goal mode's runtime half has no analogue here (agent-flow's driver is /flow-run).

Verification

bash tests/kit-invariants.sh   # 154/154
bash tests/kit-bin.test.sh     #  49/49

kit/commands/flow-card.md is 236 lines against a new 270-line budget in tests/kit-invariants.sh.

Contract lines that moved

None. This PR adds a command and its budget; card-eval.md, plan-format.md, flow-check.md, flow-run.md and every worker prompt are unchanged. docs/design-notes.md records problem → mechanism → limit.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Tdu4p6jdzNSQd7P71iBw8G

dinershtein and others added 3 commits August 1, 2026 20:49
A rough card is underspecified in exactly the ways triage detects and
cannot fix alone, so it pays a three-command round-trip: /flow-check →
[meta] QUESTIONS → Human Questions → /flow-questions → Backlog →
/flow-check again. The human answers hours later, without the context
that made the intention obvious when they typed it.

/flow-card <rough intention> moves that Q&A to authoring time: ground
the sentence in the repo, sort the eight card-eval gap categories
through the same auto-answer policy triage uses ([meta] ASSUMED for the
safe ones), ask at most three AskUserQuestion turns for the gaps that
genuinely need a human, then create one Backlog card carrying a
completion contract (Goal / Why / Done when / Out of scope / Stop if /
Context).

Deliberately not a second planner: no approach, no file manifest, no
test commands — the WHAT/HOW split and the plan-approval gate are
untouched. Exactly one card per invocation; an intention worth several
PRs is narrowed to its first slice and the rest parked in Icebox, so
/flow-check's SPLIT path stays the single tested splitter.

No new config keys, no new states, no changes to any existing prompt —
the artifact is an ordinary Backlog card and every downstream stage is
unchanged. A hand-written card behaves exactly as before.

Verification: kit-invariants 154/154, kit-bin 49/49.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tdu4p6jdzNSQd7P71iBw8G
Three corrections from reading MoonshotAI/kimi-code's goal mode (its
write-goal skill plus the runtime spec in its GOAL.md):

- Show before you create. The command wrote the card and then printed
  it, so the human first read the contract on the board — where every
  wording fix costs a round-trip through the tracker UI. Now the full
  title and body are shown with the choices behind them, and a final
  Create/Revise/Discard gesture gates create_item. The approval turn is
  explicitly outside the three-question budget, which is for gaps.
- Done when = proof, not effort. The bullet asked for observable
  behavior and warned off commands, which reads as "don't name the
  test suite". It should name an existing verification when the repo
  has one — a suite, a lint rule, a zero-hit search, a metric — while
  still not prescribing the approach that reaches it.
- A first failing attempt is not a stop condition. `## Stop if` invited
  escalation at the first snag; kimi's blocked audit (a blocker must
  survive repeated turns, and "large / slow / unclear / would benefit
  from clarification" never qualifies) is the right bar for a card that
  meta and the worker both read.

Verification: kit-invariants 154/154 (flow-card.md 236 lines, budget 270).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tdu4p6jdzNSQd7P71iBw8G
Self-review found the step-7 approval gate contradicted two exits added
before it. The Escapes branch (Park in Icebox, cancelled prompt) and the
Too big branch both said "create in icebox" from step 5 — skipping
compose and approval, and contradicting the contract line one screen
above that forbids exactly that. Both now change the destination, not
the route: still composed, still shown, created in step 8. A parked card
is one the human reads months later, so it earns the same review as any
other.

Also: `## Done when` was told to name an existing verification without
being told to go find one. Step 2 now reads the target's test_cmd /
lint_cmd from tracker.json and notes what the repo already uses to prove
this kind of change — the card cannot ask for proof the author never
looked for.

Verification: kit-invariants 154/154 (flow-card.md 246 lines, budget 270).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tdu4p6jdzNSQd7P71iBw8G
@dinershtein

Copy link
Copy Markdown
Contributor Author

Self-review before asking for a second pair of eyes — two defects found and fixed in 443fe46:

  1. The approval gate contradicted two exits added before it. Park in Icebox, a cancelled prompt, and the too-big branch all said "create in icebox" from step 5 — skipping compose and approval, and contradicting the contract line one screen above. All three now change the destination, not the route.
  2. ## Done when asked for proof without saying where to find it. Step 2 now reads the target's test_cmd/lint_cmd from tracker.json and notes what the repo already uses to prove this kind of change.

Not covered by anything here: this command has never created a card. The kit's tier-2 (behavioral) checks are deliberately out of CI, so everything green above is static.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant