Skip to content

codehub init — bootstrap a repo

codehub init is the one-command on-ramp. Run it inside any repo you want OpenCodeHub to cover. It installs a project-scope Claude Code plugin, writes the .mcp.json entry, appends .codehub/ to .gitignore, and seeds a policy starter.

Project scope on purpose. Everything lands under the repo root (not ~/.claude/). Check .claude/, .mcp.json, and opencodehub.policy.yaml into git and every teammate who clones gets the plugin automatically.

codehub init (from a clean repo)
$ codehub init
codehub init: installed plugin assets under .claude/
codehub init: wrote hooks to /path/to/repo/.claude/settings.json
codehub setup (claude-code): wrote MCP entry to /path/to/repo/.mcp.json
codehub init: appended ".codehub/" to .gitignore
codehub init: seeded opencodehub.policy.yaml (all rules commented out)
Next: run 'codehub analyze' to build the graph, then restart Claude Code.
.claude/
├── agents/
│ └── code-analyst.md # graph-grounded analysis subagent
├── commands/ # 5 slash commands
│ ├── probe.md
│ ├── verdict.md
│ ├── owners.md
│ ├── audit-deps.md
│ └── rename.md
├── hooks/ # PostToolUse / Stop scripts
│ ├── augment.sh # enriches Bash/Grep/Glob with graph context
│ └── docs-staleness.sh # non-blocking "/codehub-document --refresh" hint
├── settings.json # project-scope hooks config
└── skills/ # 11 skills
├── codehub-document/ # artifact factory skills
├── codehub-pr-description/
├── codehub-onboarding/
├── codehub-contract-map/
├── codehub-code-pack/
├── opencodehub-guide/ # analysis skills
├── opencodehub-exploring/
├── opencodehub-impact-analysis/
├── opencodehub-debugging/
├── opencodehub-refactoring/
└── opencodehub-pr-review/
  • .mcp.jsonmcpServers.codehub entry so Claude Code launches the MCP server automatically.
  • .gitignore.codehub/ appended (local graph state stays out of git by default).
  • opencodehub.policy.yaml — starter file with every rule commented out. Uncomment when the CI verdict actions ship (spec 002 P1).
FlagDefaultPurpose
--forceoffOverwrite conflicting files under .claude/. Without it, a re-run with any existing .claude/ contents refuses and lists every conflict.
--skip-mcpoffSkip the .mcp.json write. Useful when MCP config is managed at user scope (~/.claude.json).
--skip-policyoffSkip the opencodehub.policy.yaml seed.
[path]process.cwd()Positional target directory.

Re-running with the same args produces byte-identical output for settings.json, .mcp.json, .gitignore, and the policy file. The policy file is not re-seeded if it already exists — init only creates it, never overwrites it, even under --force.

Conflicts under .claude/ (e.g., a skill file you’ve locally modified) abort the run without --force. The error names every conflict so you can decide file-by-file.

Run codehub analyze to build the graph, then restart Claude Code so it picks up the new project-scope plugin.

Terminal window
codehub analyze .

See Your first query for what to do once the graph is built.