mach10 icon indicating copy to clipboard operation
mach10 copied to clipboard

Standardize optional [context] argument across all mach10 commands

Open LeanAndMean opened this issue 6 months ago • 5 comments

Summary

Several mach10 commands accept an optional free-text `[context]` (or near-equivalent: `[scope]`, `[aspects]`, `[findings]`) argument that lets users modify default behavior without editing the command file. The other commands lack this affordance. This issue proposes standardizing the convention so every command accepts an optional free-text override.

Motivation

The user's natural workflow is: invoke a command, then nudge it. Without a context argument, the user has to either accept the default behavior or interrupt and re-prompt mid-flight. With a context argument, the user can say things like:

  • `/mach10:pr-pre-merge 123 skip the version bump`
  • `/mach10:issue-plan 55 focus on the migration story`
  • `/mach10:issue-implement 55 2 use the existing helper instead of adding a new one`
  • `/mach10:test-audit only the auth module`
  • `/mach10:push and reference issue 137 in the comment`

Current state inventory

Already accept context-style arg:

  • `/mach10:pr-create [issue] [context]`
  • `/mach10:pr-review [aspects]`
  • `/mach10:pr-review-fix [--review-comment ] [--assessment-comment ] [findings] [context]`
  • `/mach10:pr-ci-fix [context]`
  • `/mach10:doc-review [scope]`

Lack a context arg:

  • `/mach10:pr-pre-merge `
  • `/mach10:pr-merge `
  • `/mach10:issue-assessment `
  • `/mach10:issue-plan `
  • `/mach10:issue-plan-review `
  • `/mach10:issue-implement `
  • `/mach10:push`
  • `/mach10:test-audit`

Proposed shape

For each command lacking the argument:

  1. Add `[context]` to its `argument-hint` frontmatter.
  2. Add a Step 0 sub-section instructing parsing of optional free-text after the structured arguments and noting that downstream steps should honor it where it makes sense.
  3. Decide which downstream step(s) should apply the context. For each command, identify what kinds of overrides users will plausibly pass and where in the workflow they should take effect.
  4. Update the README command table and Phase prose to reflect the new arguments.

Open questions to settle in the plan stage:

  • Should commands with specialized free-text arguments (`[aspects]`, `[scope]`, `[findings]`) be renamed to the generic `[context]` for consistency, or kept domain-specific?
  • For commands where context could meaningfully alter destructive behavior (e.g., `pr-merge`), what context overrides are safe vs. those that should require explicit confirmation?
  • Should there be a documented convention for what kinds of overrides each command accepts, or is free-text best-judgment-by-Claude sufficient?

Considerations

  • This is a cross-cutting change touching every command file, the README command table, and Phase descriptions. The work decomposes naturally into one stage per command.
  • Each command's context handling needs to be designed individually — `pr-merge` accepting context that suppresses release creation is meaningful, while `push` accepting context that adjusts the comment body is comparatively trivial.
  • The existing `[scope]` / `[aspects]` / `[findings]` arguments should be reviewed: are they truly distinct from `[context]` (e.g., `[findings]` is structured F1/S2 identifiers, not free-text), or should they be unified?

Out of scope

  • The implementation of `pr-test-plan` itself (issue #136) — that command is being added with `[context]` from the start.

LeanAndMean avatar May 07 '26 21:05 LeanAndMean

Implementation Plan: Standardize [context] argument across all commands

Overview

Unify all optional free-text arguments ([aspects], [scope], [optional-description], [optional-commit-message], [optional-scope]) to a standard [context] argument across all 14 mach10 commands. Add [context] to the 6 commands that currently lack any free-text argument. Fix the existing forwarding gap in issue-implement. Update README and CLAUDE.md.

Architecture approach: Pragmatic Balance

Every command gets [context] as its optional trailing free-text argument. Context is consumed via three injection patterns depending on what the command does:

  • Skill delegation: Append > **User context:** <context> to the Skill invocation block (conditional on context being provided). Used by issue-implement, pr-review-fix, pr-ci-fix.
  • Agent-steering: Include context in each exploration/review agent's prompt to focus their work. Used by issue-assessment, issue-plan, issue-plan-review, doc-review, test-audit.
  • Direct use: Context informs in-command decisions (commit message, checklist priorities, release drafting, review focus). Used by push, pr-pre-merge, pr-merge, pr-create, pr-review, issue-create.

Stage 1: Pure renames (push, test-audit, issue-create)

Goal: Rename existing non-[context] optional arguments to [context] in the 3 commands where the argument already exists but uses a different label.

Files modified:

  • commands/push.md
  • commands/test-audit.md
  • commands/issue-create.md

push.md

  • Frontmatter: argument-hint: [optional-commit-message] -> argument-hint: [context]
  • Step 2 (line 33): Rewrite the $ARGUMENTS interpretation sentence. Current: "Uses the user's override message if one was provided: $ARGUMENTS". New: broaden to general context -- if the input reads like a commit message, use it verbatim; otherwise, treat it as guidance for the commit message generation. Context can also influence the progress comment in Step 4 and next-step suggestions in Step 5.

test-audit.md

  • Frontmatter: argument-hint: [optional-scope] -> argument-hint: [context]
  • Header label (line 11): **Scope (optional):** $ARGUMENTS -> **Context (optional):** $ARGUMENTS
  • Step 1 (line 21): Replace single-purpose scope sentence with dual-interpretation: if $ARGUMENTS looks like a file path or glob pattern, use as scope restriction; if it reads as prose, keep discovery repo-wide but note it as quality-focus guidance for Step 3 agents.
  • Step 3: Add a sentence instructing that if prose context was provided, include it in each review agent's prompt to steer the quality assessment.

issue-create.md

  • Frontmatter: argument-hint: [optional-description] -> argument-hint: [context]
  • Header label (line 11): **Initial context (optional):** $ARGUMENTS -> **Context (optional):** $ARGUMENTS
  • Step 1 (line 15): Update "description" references to "context" (e.g., "If context was provided ($ARGUMENTS), use it as the starting point for drafting").

Testing: Invoke each command with and without context to verify parsing works. Confirm push still accepts a bare commit message and test-audit still accepts a bare path.


Stage 2: Semantic renames + bug fix (doc-review, pr-review, issue-implement)

Goal: Rename [scope] and [aspects] to [context] in commands that already have context-like arguments. Fix the forwarding gap in issue-implement where [context] exists in the argument-hint but is never forwarded to the Skill delegation.

Files modified:

  • commands/doc-review.md
  • commands/pr-review.md
  • commands/issue-implement.md

doc-review.md

  • Frontmatter: argument-hint: <pr-number> [scope] -> argument-hint: <pr-number> [context]
  • Step 0 parse block (line 17): Change bullet from "A scope to narrow the review (optional)" to "Additional context or scope to narrow the review (optional)".
  • Step 0 extraction sentence (line 24): "If a scope is provided, note it for filtering in Step 3 onward." -> "If context is provided, note it for filtering and focus in Step 3 onward."
  • Step 3 (line 91): "If a scope was provided, filter to only categories and files matching that scope." -> "If context was provided, use it to narrow or focus the review: if it names specific docs or areas, filter to those; if it reads as prose guidance, pass it to review agents in Step 4."
  • Step 4 agent prompts: Add context pass-through when context is prose guidance (include in each agent's briefing).

pr-review.md

  • Frontmatter: argument-hint: <pr-number> [aspects] [context] -> argument-hint: <pr-number> [context]
  • Step 0 parse block (lines 19-21): Collapse two separate bullets ("Review aspects to focus on" and "Additional context or constraints") into a single bullet: "Additional context, focus areas, or constraints (optional)".
  • Step 0 parse sentence (line 27): "If specific review aspects are mentioned, note them for Step 2." -> "If context was provided, note it for Step 2."
  • Step 2 Skill invocation (lines 66-67): Change "Focus on: <aspects>" to "Additional context: <context>". The no-context branch stays as-is: "Review PR #<pr-number>".

issue-implement.md (bug fix)

  • Frontmatter: No change (already <issue-number> <stage(s)> [context]).
  • Step 4 Skill invocation (after line 140): After the existing context block that ends with "IMPORTANT: After reading the development plan phases...", add the conditional forwarding pattern:
    If the user provided additional context or constraints in their input (parsed in Step 1), append it:
    > **User context:** <the additional context or constraints from the user's input>
    
    This follows the established pattern from pr-review-fix.md (lines 124-126).

Testing: Invoke doc-review 108 only README and pr-review 108 focus on error handling to verify context flows through. Invoke issue-implement 55 2 but only the frontend parts to verify context now appears in the Skill delegation.


Stage 3: Fresh additions (issue-assessment, issue-plan, issue-plan-review, pr-pre-merge, pr-merge)

Goal: Add [context] to the 5 commands that currently accept only a required number argument with no optional free-text.

Files modified:

  • commands/issue-assessment.md
  • commands/issue-plan.md
  • commands/issue-plan-review.md
  • commands/pr-pre-merge.md
  • commands/pr-merge.md

issue-assessment.md

  • Frontmatter: argument-hint: <issue-number> -> argument-hint: <issue-number> [context]
  • Step 1 parse block (after line 18): Add bullet: "- Additional context or constraints (optional)". Add: "If context was provided, note it for use in Steps 3-4."
  • Step 3 agent launches (before line 45): Add sentence: "If the user provided context, include it in each agent's prompt to focus exploration on the user's areas of concern."

issue-plan.md

  • Frontmatter: argument-hint: <issue-number> -> argument-hint: <issue-number> [context]
  • Step 0 parse block: Add bullet: "- Additional context or constraints (optional)". Add: "If context was provided, note it for use during exploration and planning."
  • Step 2b agent launches: Add sentence: "If the user provided context, include it in each agent's prompt to guide exploration focus."
  • Step 4 architecture agents: Add sentence: "If the user provided context, include it in each agent's prompt so architecture designs account for the user's constraints or preferences."

issue-plan-review.md

  • Frontmatter: argument-hint: <issue-number> -> argument-hint: <issue-number> [context]
  • Step 0 parse block: Add bullet: "- Additional context or constraints (optional)". Add: "If context was provided, note it for use during exploration and review."
  • Step 2b agent launches: Add sentence: "If the user provided context, include it in each agent's prompt to focus review on the user's areas of concern."

pr-pre-merge.md

  • Frontmatter: argument-hint: <pr-number> -> argument-hint: <pr-number> [context]
  • Step 0 parse block: Add bullet: "- Additional context or constraints (optional)". Add: "If context was provided, note it for use in Step 5."
  • Step 5 (top of section, after line 143): Add sentence: "If the user provided context, use it to inform checklist priorities (e.g., 'skip version bump' means skip 5b, 'focus on docs' means be thorough in 5a). Context never bypasses the user confirmation gates -- it only guides which items to prioritize."

pr-merge.md

  • Frontmatter: argument-hint: <pr-number> -> argument-hint: <pr-number> [context]
  • Step 1 parse block: Add bullet: "- Additional context or constraints (optional)". Add: "If context was provided, note it for use in later steps (e.g., release notes guidance, version tag preference)."
  • Step 4 (top of section, before the AskUserQuestion): Add sentence: "If the user provided context about release creation (e.g., 'skip release', 'tag as v2.0.0'), let it inform the options presented. Context does not auto-execute -- it guides the draft and defaults."
  • Step 5: Add sentence: "If the user provided context, use it to inform the release draft (e.g., specific tag, highlighted changes, notes style)."

Testing: Invoke each command with context to verify it flows through to the appropriate downstream step. Verify that pr-merge and pr-pre-merge context never bypasses user confirmation gates.


Stage 4: Documentation sync + version bump

Goal: Update README command tables, Phase descriptions, and CLAUDE.md conventions to reflect the standardized [context] argument. Bump plugin version. Must be last since it reflects the final state of all command files.

Files modified:

  • README.md
  • CLAUDE.md
  • .claude-plugin/plugin.json

README.md

Issue lifecycle table (lines 247-251): Update argument syntax for each row:

  • /mach10:issue-assessment <number> -> /mach10:issue-assessment <number> [context]
  • /mach10:issue-plan <number> -> /mach10:issue-plan <number> [context]
  • /mach10:issue-plan-review <number> -> /mach10:issue-plan-review <number> [context]
  • /mach10:issue-implement <issue> <stage> -> /mach10:issue-implement <issue> <stage> [context]
  • /mach10:issue-create -> /mach10:issue-create [context]

PR lifecycle table (lines 257-263): Update argument syntax:

  • /mach10:pr-review <pr> [aspects] -> /mach10:pr-review <pr> [context]
  • /mach10:doc-review <pr> [scope] -> /mach10:doc-review <pr> [context]
  • /mach10:pr-pre-merge <pr> -> /mach10:pr-pre-merge <pr> [context]
  • /mach10:pr-merge <pr> -> /mach10:pr-merge <pr> [context]
  • pr-create, pr-review-fix, pr-ci-fix rows already show [context] -- no change.

Utilities table (lines 269-270): Update argument syntax:

  • /mach10:push -> /mach10:push [context]
  • /mach10:test-audit -> /mach10:test-audit [context]

Phase descriptions (lines 124-189): Update command syntax references:

  • Phase 1 (line 134): /mach10:issue-assessment <number> -- add [context]
  • Phase 2 (line 142): /mach10:issue-plan <number> -- add [context]
  • Phase 3 (line 154): /mach10:issue-plan-review <number> -- add [context]
  • Phase 4 (line 162): /mach10:issue-implement <issue> <stage> -- add [context]
  • Phase 5 (line 170): /mach10:pr-create [issue] -- add [context] (already has it in table but check Phase prose)
  • Phase 6 (line 176): /mach10:pr-review <pr> -- rename [aspects] to [context]
  • Phase 7 (line 186): /mach10:doc-review <pr> -- rename [scope] to [context]; /mach10:pr-pre-merge <pr> -- add [context]; /mach10:pr-merge <pr> -- add [context]

Quick reference session log (lines 194-214): These show example invocations without optional args. No change needed since [context] is optional everywhere.

CLAUDE.md

Writing Commands section: Add a convention bullet after the existing argument-hint requirement:

  • Use [context] as the standard name for any optional free-text argument in argument-hint. Do not use command-specific labels like [scope], [aspects], or [optional-description]. For commands that delegate to a Skill, forward context using > **User context:** <context> as the last item in the Skill invocation block (include only when context was provided). For commands that launch exploration/review agents, include context in each agent's prompt to focus their work.

.claude-plugin/plugin.json

  • Bump version from 1.30.0 to 1.31.0 (minor: new feature -- all commands now accept context).

Testing: Grep all command files for stale labels ([optional-, [aspects], [scope]) to confirm no remnants. Verify README table entries match command file frontmatter. Verify CLAUDE.md convention bullet is accurate.


Notes

  • No existing CLAUDE.md sync rules are affected. The argument-hint field is not part of any sync rule. The finding-identifier sync entry references pr-review-fix's hint, but that hint is unchanged. The Step 0 bootstrap sync covers parsing structure, not argument naming.
  • No allowed-tools changes needed. Context is consumed as interpretive guidance, not a separate tool operation.
  • pr-ci-fix stays as-is. Its context already works (filters which CI logs to gather). Adding **User context:** Skill forwarding would be a separate enhancement, not part of this standardization.
  • Safety for destructive commands: pr-merge and pr-pre-merge context guides evaluation/drafting steps only. Context never bypasses user confirmation gates (AskUserQuestion prompts before merge, push, or release creation).

This comment will guide staged implementation via /mach10:issue-implement 137 <stage>.

LeanAndMean avatar May 12 '26 17:05 LeanAndMean

Stage 1 implemented: pure renames

Renamed existing non-[context] optional arguments to the standard [context] label in three commands.

Files modified:

  • commands/push.md — [optional-commit-message] -> [context]; broadened Step 2 to dual-interpret (verbatim commit message vs. general guidance) and noted that context can also inform the progress comment in Step 4 and next-step suggestions in Step 5.
  • commands/test-audit.md — [optional-scope] -> [context]; broadened Step 1 to dual-interpret (path/glob = scope restriction, prose = quality-focus guidance) and added an agent-steering instruction in Step 3 so prose context flows into each review agent's prompt.
  • commands/issue-create.md — [optional-description] -> [context]; updated the header label and Step 1 references.

Commit: 75e3ac9

Notes:

  • All changes are backward-compatible. Existing invocations (bare commit messages for push, bare paths for test-audit, bare descriptions for issue-create) continue to work because the new interpretation logic auto-detects shape.
  • No CLAUDE.md sync rules are affected by this stage (per plan notes).
  • README/CLAUDE.md updates are deferred to stage 4 per the plan.

Next: stage 2 (semantic renames in doc-review, pr-review, plus the issue-implement forwarding bug fix).

LeanAndMean avatar May 12 '26 17:05 LeanAndMean

Stage 2 implemented: semantic renames + issue-implement bug fix

Renamed the existing context-like arguments to the standard [context] label in two commands, and fixed the forwarding gap in issue-implement.

Files modified:

  • commands/doc-review.md — [scope] -> [context]. Broadened Step 0 parsing, Step 3 filtering (dual-interpret: path/area filtering vs. prose guidance), and added a context pass-through bullet to Step 4 agent briefings so prose context flows into review agents.
  • commands/pr-review.md — [aspects] [context] -> [context]. Collapsed two separate Step 0 bullets into a single "Additional context, focus areas, or constraints" bullet, updated the Step 0 parse sentence, and changed the Step 2 Skill invocation from "Focus on: <aspects>" to "Additional context: <context>".
  • commands/issue-implement.md (bug fix) — No frontmatter change (already had [context]). Added the conditional forwarding pattern after the existing Step 4 Skill invocation block, mirroring the established pattern from pr-review-fix.md (lines 124-126). Context provided in user input now flows through to the feature-dev delegation as **User context:**.

Commit: 84601b6

Notes:

  • All changes are backward-compatible. doc-review and pr-review previously accepted free-text after the PR number; that still works -- only the label changed.
  • No CLAUDE.md sync rules are affected by this stage (per plan notes).
  • The issue-implement fix closes a real bug: prior to this commit, providing context to /mach10:issue-implement 55 2 only the frontend parts would parse it but never forward it to the Skill delegation.
  • README/CLAUDE.md updates and version bump are deferred to stage 4 per the plan.

Next: stage 3 (fresh [context] additions to issue-assessment, issue-plan, issue-plan-review, pr-pre-merge, pr-merge).

LeanAndMean avatar May 12 '26 18:05 LeanAndMean

Stage 3 implemented: fresh [context] additions

Added the standard [context] optional free-text argument to the 5 commands that previously accepted only a required number argument.

Files modified:

  • commands/issue-assessment.md -- frontmatter <issue-number> -> <issue-number> [context]; added context bullet to Step 1 parse block; added agent-steering instruction to Step 3 (after the run_in_background note, before "Each agent should return") so context flows into each exploration agent's prompt.
  • commands/issue-plan.md -- frontmatter updated; added context bullet to Step 0 parse block; added agent-steering instructions to both Step 2b (exploration agents) and Step 4 (architecture agents) so context guides exploration focus and architecture design.
  • commands/issue-plan-review.md -- frontmatter updated; added context bullet to Step 0 parse block; added agent-steering instruction to Step 2b so context focuses the plan review.
  • commands/pr-pre-merge.md -- frontmatter <pr-number> -> <pr-number> [context]; added context bullet to Step 0 parse block; added direct-use instruction at the top of Step 5 that uses context to inform checklist priorities. Explicit safety note: context never bypasses the user confirmation gates -- it only guides which items to prioritize.
  • commands/pr-merge.md -- frontmatter updated; added context bullet to Step 1 parse block; added direct-use instructions to Step 4 (before the release AskUserQuestion) and Step 5 (before the release draft). Explicit safety note: context does not auto-execute -- it guides the draft and defaults.

Commit: f879e3d

Notes:

  • All changes are backward-compatible. The 5 commands previously rejected any input beyond the structured number argument; with this change they accept optional trailing context. Existing invocations without context continue to work unchanged.
  • No CLAUDE.md sync rules are affected by this stage (per plan notes).
  • Safety preserved on destructive commands: context guides evaluation and drafting only, never bypassing the AskUserQuestion confirmation gates in pr-merge (release creation, modify-loop) or pr-pre-merge (branch-freshness merge prompt, version bump level).
  • Placement of context-forwarding sentences follows the established codebase convention (after the run_in_background instruction, before "Each agent should return") rather than the line numbers in the plan, since the file content has shifted slightly. Semantic placement matches the plan's intent.
  • README/CLAUDE.md updates and version bump are deferred to stage 4 per the plan.

Next: stage 4 (documentation sync + version bump in README.md, CLAUDE.md, .claude-plugin/plugin.json).

LeanAndMean avatar May 12 '26 18:05 LeanAndMean

Stage 4 implemented: documentation sync + version bump

Updated README.md, CLAUDE.md, and .claude-plugin/plugin.json to reflect the standardized [context] argument across all 14 commands. This is the final stage.

Files modified:

  • README.md -- Updated all three command tables (issue lifecycle, PR lifecycle, utilities) so every command row now shows [context]. Updated all eight phase description command references (Phase 0 through Phase 7) to include [context] -- this includes adding [context] to the issue-create, issue-assessment, issue-plan, issue-plan-review, issue-implement, pr-pre-merge, and pr-merge references, and renaming [aspects] to [context] in pr-review and [scope] to [context] in doc-review.
  • CLAUDE.md -- Added a convention bullet in the "Writing Commands" section immediately after the argument-hint requirement, establishing [context] as the standard label for optional free-text arguments and documenting both injection patterns (Skill forwarding via > **User context:** <context> and agent-steering via inclusion in each agent's prompt).
  • .claude-plugin/plugin.json -- Bumped version from 1.30.0 to 1.31.0 (minor: new feature -- all commands now accept context).

Commit: 90afe07

Verification:

  • Grepped command files, README, and CLAUDE.md for stale labels ([optional-, [aspects], [scope]). The only remaining occurrences are inside the new CLAUDE.md convention bullet that cites them as examples of what not to use. No stale labels remain anywhere else.
  • Cross-checked every README table row against its corresponding command file argument-hint frontmatter. All 14 entries match exactly.
  • Verified all eight phase description command references are consistent with the table entries.

Notes:

  • No CLAUDE.md sync rules were affected by this stage (per plan notes). The convention bullet was added as a new standalone rule that does not depend on or interact with the existing sync rules.
  • All four stages of the plan are now complete. The [context] standardization is fully applied: all 14 commands accept [context] as their trailing optional free-text argument; issue-implement forwards context to feature-dev (stage 2 bug fix); existing context-bearing commands (pr-create, pr-review-fix, pr-ci-fix) retain their existing behavior unchanged.

LeanAndMean avatar May 12 '26 18:05 LeanAndMean