Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ semantic versioning, and the protocol carries its own version (SPEC §5).

## [Unreleased]

### Launch readiness
- `init` also writes `CLAUDE.md`, whose first line imports `AGENTS.md`:
Claude Code loads `CLAUDE.md` and never `AGENTS.md`, so a fresh scaffold
was invisible to the harness most adopters reach for — `gh codecrew init`
then `claude` started blind. Found while assessing the README brief
(#140). Idempotent like the rest of the scaffold; spokes are unchanged.
(#141)

## [1.0.0] — 2026-08-27

The first stable release of the `gh` extension and of the protocol it
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ catalogues them all, by the verb that raises each.
```sh
gh extension install radiusred/gh-codecrew
gh codecrew version # gh never auto-updates extensions; know what you have
gh codecrew init # scaffold: .codecrew.yml, roles/, AGENTS.md, ROADMAP.md
gh codecrew init # scaffold: .codecrew.yml, roles/, AGENTS.md (+ CLAUDE.md, v1.0.1+), ROADMAP.md
gh codecrew status # open milestones, task states, raised gates
gh codecrew help # the full verb list
```
Expand Down
4 changes: 3 additions & 1 deletion docs/first-milestone.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ for patches, not for majors. Updating is always your act:
`init` writes your `.codecrew.yml` (the project's pointer file, with a
routing table declaring all four roles — `~` means "held by you"), a
`ROADMAP.md` seed, the four role contracts under `roles/`, and an
`AGENTS.md` entry point for any agent you later dispatch. Commit and push:
`AGENTS.md` entry point for any agent you later dispatch — plus, from
v1.0.1, a `CLAUDE.md` that imports it, because Claude Code loads
`CLAUDE.md` and never `AGENTS.md`. Commit and push:

```sh
git add -A && git commit -m "chore: scaffold codecrew" && git push
Expand Down
5 changes: 3 additions & 2 deletions docs/identities.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@ stop using the framework:
the merged milestone documents under `docs/milestones/` are the audit
trail; nothing needs deleting for the framework to be gone.
- **The pointer and contracts** — `.codecrew.yml`, `roles/`, `AGENTS.md`,
`ROADMAP.md` in each repo. Delete or keep; they are plain files with no
hooks.
`CLAUDE.md` (hub only; it imports `AGENTS.md` for Claude Code — keep it
if you had one of your own), `ROADMAP.md` in each repo. Delete or keep;
they are plain files with no hooks.
- **Labels** — `cc:milestone`, `cc:task`, `cc:needs-decision` on each repo,
created on first use. Remove in the repo's label settings if you like.
- **Task branches** — `task finish` deletes a merged head and `milestone
Expand Down
12 changes: 12 additions & 0 deletions internal/cli/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ GitHub issues and PRs, per the protocol at
operator) — and never chooses or briefs its own judge.
`

// claudeScaffold bridges Claude Code to the harness-neutral entry point:
// Claude Code loads CLAUDE.md, never AGENTS.md (code.claude.com/docs/en/memory),
// so without this file a fresh scaffold is invisible to it. The import must
// be the first line; anything Claude-specific goes below it.
const claudeScaffold = `@AGENTS.md

<!-- CodeCrew: Claude Code reads CLAUDE.md, not AGENTS.md; the import above
loads the entry point every harness shares. Add Claude-specific
instructions below it. -->
`

// scaffold writes the greenfield files into dir. Hub mode (hub == "self")
// writes the full set; spoke mode writes only the pointer. Existing files
// are never touched — they are reported as skipped.
Expand All @@ -83,6 +94,7 @@ func scaffold(dir, hub string, contracts fs.FS) (written, skipped []string, err
} else {
files["ROADMAP.md"] = roadmapScaffold
files["AGENTS.md"] = agentsScaffold
files["CLAUDE.md"] = claudeScaffold
entries, err := fs.ReadDir(contracts, "roles")
if err != nil {
return nil, nil, err
Expand Down
54 changes: 53 additions & 1 deletion internal/cli/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestScaffoldHub(t *testing.T) {
if len(skipped) != 0 {
t.Errorf("fresh dir skipped %v", skipped)
}
for _, want := range []string{".codecrew.yml", "ROADMAP.md", "AGENTS.md", filepath.Join("roles", "qa.md")} {
for _, want := range []string{".codecrew.yml", "ROADMAP.md", "AGENTS.md", "CLAUDE.md", filepath.Join("roles", "qa.md")} {
if !slices.Contains(written, want) {
t.Errorf("missing %s from written %v", want, written)
}
Expand Down Expand Up @@ -192,3 +192,55 @@ func TestHelpIsNotAnError(t *testing.T) {
}
}
}

// Claude Code loads CLAUDE.md and never AGENTS.md, so the hub scaffold must
// write a CLAUDE.md whose first line imports the shared entry point — else
// "gh codecrew init && claude" starts blind (#141).
func TestScaffoldedClaudeImportsAgents(t *testing.T) {
dir := t.TempDir()
if _, _, err := scaffold(dir, "self", fakeContracts); err != nil {
t.Fatal(err)
}
data, err := os.ReadFile(filepath.Join(dir, "CLAUDE.md"))
if err != nil {
t.Fatal(err)
}
first, _, _ := strings.Cut(string(data), "\n")
if first != "@AGENTS.md" {
t.Errorf("CLAUDE.md first line = %q, want %q", first, "@AGENTS.md")
}
if strings.Contains(string(data), "`@AGENTS.md`") {
t.Error("the import must not be wrapped in backticks — Claude Code treats that as literal text")
}
}

func TestScaffoldSpokeWritesNoClaude(t *testing.T) {
dir := t.TempDir()
written, _, err := scaffold(dir, "owner/hub", fakeContracts)
if err != nil {
t.Fatal(err)
}
for _, f := range written {
if f == "CLAUDE.md" || f == "AGENTS.md" {
t.Errorf("spoke scaffold wrote %s; spokes get only the pointer", f)
}
}
}

func TestScaffoldKeepsExistingClaude(t *testing.T) {
dir := t.TempDir()
marker := filepath.Join(dir, "CLAUDE.md")
if err := os.WriteFile(marker, []byte("mine\n"), 0o644); err != nil {
t.Fatal(err)
}
_, skipped, err := scaffold(dir, "self", fakeContracts)
if err != nil {
t.Fatal(err)
}
if !slices.Contains(skipped, "CLAUDE.md") {
t.Errorf("existing CLAUDE.md not reported as skipped: %v", skipped)
}
if data, _ := os.ReadFile(marker); string(data) != "mine\n" {
t.Error("existing CLAUDE.md was overwritten")
}
}
Loading