Skip to content

feat(serve): session-start hook wiring + CLAUDE.md warm-start section#179

Merged
stackbilt-admin merged 1 commit into
mainfrom
feat/issue-155-hook-and-session-start
May 23, 2026
Merged

feat(serve): session-start hook wiring + CLAUDE.md warm-start section#179
stackbilt-admin merged 1 commit into
mainfrom
feat/issue-155-hook-and-session-start

Conversation

@stackbilt-admin
Copy link
Copy Markdown
Member

Summary

Closes #155 — the final two items from the session continuity feature:

  • charter hook print --claude — new subcommand on the existing hook command that prints a copy-pasteable UserPromptSubmit hook config. Pasting it into .claude/settings.json makes Claude Code auto-run charter context-refresh --once at every session open, so charter_context returns live project state (open work, recent decisions, metric ceilings) before the agent acts on anything.
  • Bootstrap next stepcharter bootstrap now surfaces charter hook print --claude with an explicit reason line: agents that skip this start cold, re-inferring constraints already declared in .ai/.
  • ## Session Start in generated CLAUDE.md — both pointer templates (POINTER_CLAUDE_MD, POINTER_CLAUDE_MD_HYBRID) now include a ## Session Start section telling Claude to call charter_context first, with a fallback path for sessions where charter serve isn't running.
  • Design note: the hook command is a generator, not a writer — .claude/settings.json is user-controlled. Charter emits the snippet; the user pastes it.

Test plan

  • charter hook print --claude outputs valid JSON with UserPromptSubmit and charter context-refresh --once
  • charter hook print (without --claude) throws with actionable error
  • charter bootstrap next steps include the hook command entry
  • charter adf init --emit-pointers writes CLAUDE.md containing ## Session Start and charter_context
  • Session Start appears before ## Environment (thin) and before ## Module Index (hybrid)
  • 24/24 tests pass across hook, bootstrap, and adf-init test files
  • TypeScript clean

🤖 Generated with Claude Code

…#155)

- `charter hook print --claude` emits the UserPromptSubmit hook config JSON
  that auto-runs `charter context-refresh --once` at each Claude Code session open
- `charter bootstrap` nextSteps now surfaces the hook command with a reason line
  explaining that charter_context returns live state, not a cold snapshot
- Both POINTER_CLAUDE_MD templates (thin and hybrid) gain a `## Session Start`
  section directing agents to call charter_context before any other action,
  with fallback instructions for sessions without charter serve running
- docs/cli-reference.md updated to document --emit-pointers Session Start output

Closes #155.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stackbilt-admin stackbilt-admin merged commit 53aa69a into main May 23, 2026
5 checks passed
@stackbilt-admin stackbilt-admin deleted the feat/issue-155-hook-and-session-start branch May 23, 2026 11:16
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.

feat: session continuity — context-refresh command + warm session start pattern for Claude Code

1 participant