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-codeNeeds Git for Windows on Windows: Claude Code runs hooks with Git Bash.
What happens when
| When | Hook | What happens |
|---|---|---|
| A session starts, resumes, is cleared or compacted | SessionStart | .groundwork/hooks/session-start.mjs prints the brief into the session |
| A turn ends | Stop | A checkpoint. If the handoff is behind, the agent is asked to save it, once per commit |
| Before a compaction | PreCompact | A checkpoint, and the summary is told what to keep |
| The session ends | SessionEnd | A last checkpoint |
You type /gw | Skill | Resume 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
| Path | What it is |
|---|---|
.claude/settings.json | The hooks. Merged into your file, never replaced |
.claude/skills/gw/SKILL.md | The /gw command |
CLAUDE.md | A 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:
| Added | What it does |
|---|---|
/gw-approve, /gw-reject | Human-only skills: disable-model-invocation stops the model running them |
.claude/agents/gw-*.md | Tester, implementer and reviewer subagents. The reviewer has no file-edit tool |
PreToolUse guard | Runs 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 recorder | Records 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 checkin 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.