~/groundwork

Claude Code

Every Claude Code session starts with your project's brief and saves on its way out.

In Claude Code, every session starts with the brief, and your work is saved when a turn ends, before a compaction and when the session closes. Type /gw to resume or save.

npx groundwork-ai init --adapter claude-code     # or: npx groundwork-ai adapter add claude-code

Needs Git for Windows on Windows: Claude Code runs hooks with Git Bash.

What happens when

WhenHookWhat happens
A session starts, resumes, is cleared or compactedSessionStart.groundwork/hooks/session-start.mjs prints the brief into the session
A turn endsStopA checkpoint. If the handoff is behind, the agent is asked to save it, once per commit
Before a compactionPreCompactA checkpoint, and the summary is told what to keep
The session endsSessionEndA last checkpoint
You type /gwSkillResume from memory, or save

The SessionStart matcher is startup|resume|clear|compact. These hooks never block your work. Set "nudge": false in .groundwork/config.json to drop the reminder and keep the checkpoint.

Files it writes

PathWhat it is
.claude/settings.jsonThe hooks. Merged into your file, never replaced
.claude/skills/gw/SKILL.mdThe /gw command
CLAUDE.mdA short pointer that loads AGENTS.md

npx groundwork-ai doctor checks the wiring and gives the fix for anything missing.

With the optional flow on

init --flow or flow on adds, and needs Claude Code 2.1.295 or later:

AddedWhat it does
/gw-approve, /gw-rejectHuman-only skills: disable-model-invocation stops the model running them
.claude/agents/gw-*.mdTester, implementer and reviewer subagents. The reviewer has no file-edit tool
PreToolUse guardRuns the commit gate, protects Groundwork's own files, and runs your guards before every shell command and file write. It fails closed ("onFailure": "block")
UserPromptSubmit recorderRecords your own /gw-approve, so a card commit needs your approval of the work as it is now

What it does not enforce:

  • Test files. Nothing stops the implementer editing a test. The reviewer checks the diff for it.
  • A determined agent. A shell can be used in ways a hook can't foresee. For a hard gate, run npx groundwork-ai check in CI.
  • Older Claude Code. Before 2.1.295, a guard that can't start lets the call through.

If the guard itself breaks, every shell command and file write is blocked until you fix it from your own terminal: run npx groundwork-ai doctor, then restore the files from git or run npx groundwork-ai upgrade.

Status

Built from Claude Code's hook documentation. The memory hooks have not yet been run inside a live session. If a session doesn't show the brief, run npx groundwork-ai brief yourself.

On this page