Skip to content

feat: keep project CLAUDE.md pointing at the latest gstack design doc#1553

Open
karthikcsq wants to merge 1 commit into
garrytan:mainfrom
karthikcsq:feat/claude-md-artifact-pointers
Open

feat: keep project CLAUDE.md pointing at the latest gstack design doc#1553
karthikcsq wants to merge 1 commit into
garrytan:mainfrom
karthikcsq:feat/claude-md-artifact-pointers

Conversation

@karthikcsq
Copy link
Copy Markdown

Why

After running /office-hours, the design doc lives in ~/.gstack/projects/<slug>/. The project's CLAUDE.md doesn't know about it. The next session, a new Claude has to guess (or be told) which design is canonical. Multiply by every artifact-writing skill (CEO review, eng review, design review) and the "which file is current?" question becomes a tax on every session.

What this PR does

Adds bin/gstack-claude-md-update, a small helper that finds-or-appends a backtick-wrapped artifact pointer in the project's CLAUDE.md. Wires it into /office-hours at the end of Phase 5. Pattern is now available for other artifact-writing skills to adopt.

Edit-tolerant: the user can move the pointer line into any section, under any heading, with any surrounding prose. The helper finds it by content pattern, not by line number. Deleting the pointer triggers a clean re-append at end of file under a ## Latest gstack artifacts heading. Re-runs are idempotent; no duplicate sections accumulate.

Never creates CLAUDE.md unilaterally — silent no-op if absent. The helper is a citizen, not an installer.

Opt-out

gstack-config set claude_md_artifact_pointers false

Default is true. Config key documented in the gstack-config CONFIG_HEADER.

Helper usage

gstack-claude-md-update --artifact-type <type> --path <abspath> [--project-root <path>]

Known artifact types (rendered label in CLAUDE.md):

  • design → "design doc"
  • ceo-plan → "CEO plan"
  • eng-plan → "engineering plan"
  • design-spec → "design spec"
  • checkpoint → "checkpoint"
  • (unrecognized types render verbatim — extensible by callers)

Project root resolution order: --project-root flag → git rev-parse --show-toplevel\$PWD.

Test plan

  • Pipe-tested the helper standalone with synthetic invocations covering: missing CLAUDE.md (silent no-op), empty CLAUDE.md (appends fresh section), in-place update with newer path, second artifact type added to existing section (stacks bullets under same heading), user-moved pointer line in custom section (still found and updated), opt-out via config (no file change).
  • Ran bun run gen:skill-docs --host all to regenerate office-hours/SKILL.md from the updated .tmpl.
  • Verified bun run skill:check reports ✅ office-hours/SKILL.md.tmpl → office-hours/SKILL.md (unrelated pre-existing failures on claude/SKILL.md and a couple host folders remain — independent of this PR; verified by git stash + re-running check).
  • Verified git status shows only the 6 intended files (no spurious regen artifacts).
  • End-to-end dogfooded the underlying approach on a real project: ran /office-hours on a new repo, observed CLAUDE.md gained the pointer line and survived a manual move to a different section across a second invocation.

Out of scope (deliberately deferred to keep this PR reviewable)

  • Wiring into plan-ceo-review, plan-eng-review, plan-design-review, design-consultation. Happy to follow up in separate PRs if you accept the pattern.
  • Claude Code hook templates (the skill-side approach is cleaner — no per-project hook installation, no watcher-startup-timing caveats).
  • Renaming or restructuring existing CLAUDE.md sections that gstack already appends to (skill routing).

Known cosmetic limitation

When inserting a second artifact bullet into an existing ## Latest gstack artifacts section that had a trailing blank before the next heading, the two bullets end up separated by a blank line instead of being adjacent. Markdown renders identically; not worth more awk complexity in this PR. Easy follow-up if it bothers anyone.

🤖 Generated with Claude Code

Adds `bin/gstack-claude-md-update`, a generic helper that finds-or-appends
a backtick-wrapped artifact pointer line in the project's CLAUDE.md. Wires
it into /office-hours at the end of Phase 5, after the design doc is written.

The helper is edit-tolerant: the user can move the pointer line into any
section, under any heading, with any surrounding prose — it's matched by
content pattern, not by line number. Deleting the pointer triggers a clean
re-append at end of file under a `## Latest gstack artifacts` heading.
Re-runs are idempotent; no duplicate sections accumulate. Silent no-op
when CLAUDE.md doesn't exist — never created unilaterally.

Opt-out: `gstack-config set claude_md_artifact_pointers false` (default true).

Out of scope (deferred to follow-up PRs if maintainers want them):
- Wiring into plan-ceo-review, plan-eng-review, plan-design-review, design-consultation
- Claude Code hook templates (skill-side approach is cleaner)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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