| name | init-governance |
| description | Initialize Context Governance structure in a new project. Scaffolds all canonical files (CONTEXT-MANIFEST, PLAN, HANDOFF, MEMORY, CONVENTIONS, SCHEMAS-INDEX, GOTCHAS, OPEN-PROBLEMS) + CLAUDE.md governance section. Run once per project. |
| user-invocable | true |
/init-governance โ Project Governance Scaffold
Language: Communicate in Hebrew. All file content in English.
Purpose: One-time initialization of the Context Governance framework in a new project. Creates the canonical file structure so that all governance skills (bootstrapper, live-state-orchestrator, impact-safe-executor, evidence-debugger, parallel-session-merge, context-governance) can operate.
Reference: ~/.claude/docs/GOVERNANCE-AGENT-GUIDE.md ยง2 (canonical layout) + ยง15 (new project onboarding).
When to invoke
- Manual:
/init-governance when starting a new project
- Suggested by:
bootstrapper or context-governance when they detect a project without docs/context/CONTEXT-MANIFEST.md
- NOT for: projects that are already governed (check first!)
Pre-flight check
Before scaffolding, verify:
docs/context/CONTEXT-MANIFEST.md does NOT already exist (if it does โ abort, tell user "project is already governed")
- The current working directory IS a project root (contains code, has a
.git/ or identifiable project structure)
CLAUDE.md may or may not exist (if it exists, we AUGMENT it; if not, we CREATE a minimal one)
Phase 0 โ Intake Questions (MANDATORY)
Ask the user 4 questions before scaffolding:
Question 1 โ Project Name:
- "ืืื ืฉื ืืคืจืืืงื?"
Question 2 โ Project Description:
- "ืชืืจ ืืงืฆืจื ืื ืืคืจืืืงื ืขืืฉื (ืืฉืคื ืืื ืขื ืฉืืืฉื)"
Question 3 โ Tech Stack (optional):
- "ืื ื-tech stack? (ืฉืคืืช, frameworks, DB, deployment)" โ the user can skip this
Question 4 โ Canonical working-copy path:
- "ืืื ืื ืชืื ืืืื ืฉื ืขืืชืง-ืืขืืืื ืืงื ืื ื? (ืืจืืจืช ืืืื: ืืชืืงืืื ืื ืืืืืช)"
- Resolve the project's absolute root yourself (
pwd, or pwd -W on Windows). If the user accepts the default or skips, USE that resolved path. The answer becomes {{CANONICAL_PATH}} and MUST NOT be empty โ this field is the linchpin of the stale-copy defense: the SessionStart guard canonical-cwd-check.sh and /context-governance Lite both compare the live working directory to it, and an empty/absent field silently disables that protection (the exact gap that let a session open a stale duplicate undetected).
Phase 1 โ Create directory structure
mkdir -p docs/context
mkdir -p Plans
Phase 2 โ Create canonical files
Create each file with the templates below. Replace {{PROJECT_NAME}} and {{PROJECT_DESCRIPTION}} with intake answers.
2.1 โ docs/context/CONTEXT-MANIFEST.md
---
type: manifest
created_at: {{TODAY}}
last_verified: {{TODAY}}
canonical_working_copy: '{{CANONICAL_PATH}}'
---
# Context Manifest โ {{PROJECT_NAME}}
> Meta-index of every context file in this project. Update this file whenever a context file is added, removed, or renamed.
## โ ๏ธ Environment โ Canonical Working Copy (READ FIRST)
- **Canonical working copy:** `{{CANONICAL_PATH}}` โ the ONLY valid copy of this project. All work happens here.
- **Self-check (EVERY session, before editing anything):** confirm your CWD / opened folder IS the path above. If it differs, you may be on a stale/duplicate copy โ STOP and switch. The SessionStart guard `canonical-cwd-check.sh` enforces this automatically, and this path is cross-checked against the "Canonical Working Copy" banner in CLAUDE.md (they MUST stay identical โ update both together on any relocation).
## Hierarchy of Source-of-Truth
1. Runtime code + tests (ultimate authority)
2. Version file (if exists)
3. Plans/PLAN.md (active execution state)
4. docs/context/OPEN-PROBLEMS.md (unresolved work)
5. docs/context/HANDOFF.md (latest session bridge)
6. docs/context/MEMORY.md (durable decisions)
7. docs/context/CONVENTIONS.md (code style)
8. CLAUDE.md (orchestration)
## Canonical Files
| Path | Role | Authority | Status | Verified On |
|---|---|---|---|---|
| CLAUDE.md | Orchestration | high | ACTIVE | {{TODAY}} |
| Plans/PLAN.md | Active execution state | high | ACTIVE | {{TODAY}} |
| docs/context/CONTEXT-MANIFEST.md | This file โ meta-index | high | ACTIVE | {{TODAY}} |
| docs/context/HANDOFF.md | Session bridge | high | ACTIVE | {{TODAY}} |
| docs/context/OPEN-PROBLEMS.md | Unresolved work | high | ACTIVE | {{TODAY}} |
| docs/context/MEMORY.md | Durable decisions + lessons | high | ACTIVE | {{TODAY}} |
| docs/context/CONVENTIONS.md | Code style + patterns | medium | ACTIVE | {{TODAY}} |
| docs/context/SCHEMAS-INDEX.md | Schema/API index | medium | ACTIVE | {{TODAY}} |
| docs/context/GOTCHAS.md | Bug-driven rules | high | ACTIVE | {{TODAY}} |
## Change Log
| Date | Change | Author |
|---|---|---|
| {{TODAY}} | Initial scaffold via /init-governance | Claude Code |
2.2 โ Plans/PLAN.md
# Active Plan โ {{PROJECT_NAME}}
## Objective
{{PROJECT_DESCRIPTION}}
## Active Sub-Plans
(none yet โ add sub-plans as work begins)
## Milestone Log
| Date | Event | Reference |
|---|---|---|
| {{TODAY}} | Project initialized with Context Governance | /init-governance |
2.3 โ docs/context/HANDOFF.md
---
status: active
created_at: {{TODAY}}
consumed_at: pending
imported_into_plan_section: pending
---
# Handoff โ {{PROJECT_NAME}}
## Session Summary
Project freshly initialized. No work done yet.
## Current State
Context Governance scaffolded. All canonical files created empty.
## Open Work
Everything โ project is brand new.
## Exact Next Action
Define the first task or sub-plan in Plans/PLAN.md.
## Read These First
- CLAUDE.md
- Plans/PLAN.md
- docs/context/CONTEXT-MANIFEST.md
2.4 โ docs/context/OPEN-PROBLEMS.md
# Open Problems โ {{PROJECT_NAME}}
## P1 โ Critical / Blocking
(none yet)
## P2 โ Medium Priority
(none yet)
## P3 โ Backlog
(none yet)
2.5 โ docs/context/MEMORY.md
---
type: project_memory
scope: durable
created_at: {{TODAY}}
---
# Project Memory โ {{PROJECT_NAME}}
## Active Summary
- Project initialized {{TODAY}}
- Tech stack: {{TECH_STACK}}
- No work completed yet
## Durable Decisions
| Date | Decision | Rationale | Implications |
|---|---|---|---|
| {{TODAY}} | Adopted Context Governance framework | Prevent context drift, silent regressions, and session-to-session information loss | All sessions follow governance lifecycle |
## Lessons Learned
(none yet)
## Repeated Pitfalls
(none yet)
2.6 โ docs/context/CONVENTIONS.md
# Code & Operations Conventions โ {{PROJECT_NAME}}
## Language
- Code/comments: English
- UI text: (define per project)
- User communication: Hebrew
## Code Style
(define as the project progresses โ add rules here, not in CLAUDE.md)
## Forbidden Patterns
(add patterns that have caused bugs โ each should reference a GOTCHAS.md entry)
## Security
(add security conventions as they emerge)
2.7 โ docs/context/SCHEMAS-INDEX.md
# Schemas Index โ {{PROJECT_NAME}}
> Index of schemas, contracts, data models, API specs. Points to where they live in code โ does NOT contain definitions.
## Configuration Schemas
(add entries as schemas are created)
## API Contracts
(add entries as APIs are defined)
## Data Models
(add entries as models are defined)
2.8 โ docs/context/GOTCHAS.md
---
type: gotchas
created_at: {{TODAY}}
total_entries: 0
---
# Technical Gotchas โ {{PROJECT_NAME}}
> Append-only list of bug-driven rules. Each entry comes from a real failure.
> Never renumber. Never delete. Annotate obsolete entries with ~~strikethrough~~.
(no entries yet โ first gotcha will be #1)
Phase 3 โ Augment or create CLAUDE.md
If CLAUDE.md already exists:
- Add a Canonical Working Copy banner near the top (directly under the H1 title) carrying the SAME
{{CANONICAL_PATH}} as the manifest's canonical_working_copy (the two are cross-checked by canonical-cwd-check.sh โ they must stay identical):
> ## โ ๏ธ Canonical Working Copy โ READ BEFORE ANY ACTION
> The ONLY working copy is **`{{CANONICAL_PATH}}`**. If your CWD differs, STOP โ you may be on a stale/duplicate copy.
- Add a
## Context Governance section at the end with:
## Context Governance
This project uses the Context Governance framework.
- Entry point: `docs/context/CONTEXT-MANIFEST.md`
- Agent guide: `~/.claude/docs/GOVERNANCE-AGENT-GUIDE.md`
- Human guide: `~/.claude/docs/GOVERNANCE-HUMAN-GUIDE.md`
- Active plan: `Plans/PLAN.md`
- Handoff: `docs/context/HANDOFF.md`
If CLAUDE.md does NOT exist:
- Create a minimal one:
# {{PROJECT_NAME}}
> ## โ ๏ธ Canonical Working Copy โ READ BEFORE ANY ACTION
> The ONLY working copy is **`{{CANONICAL_PATH}}`**. If your CWD differs, STOP โ you may be on a stale/duplicate copy. (Cross-checked against CONTEXT-MANIFEST `canonical_working_copy`.)
## Project Overview
{{PROJECT_DESCRIPTION}}
## Tech Stack
{{TECH_STACK}}
## Context Governance
This project uses the Context Governance framework.
- Entry point: `docs/context/CONTEXT-MANIFEST.md`
- Agent guide: `~/.claude/docs/GOVERNANCE-AGENT-GUIDE.md`
- Human guide: `~/.claude/docs/GOVERNANCE-HUMAN-GUIDE.md`
- Active plan: `Plans/PLAN.md`
- Handoff: `docs/context/HANDOFF.md`
Phase 4 โ Verification
After all files are created:
- List all created files with sizes
- Verify
docs/context/CONTEXT-MANIFEST.md references all of them
- Run
/context-governance lite to verify the scaffold passes the health check
- Report to user in Hebrew:
ืืคืจืืืงื ืืืชืื ืืืฆืืื ืขื Context Governance.
ื ืืฆืจื X ืงืืฆืื:
- docs/context/CONTEXT-MANIFEST.md (meta-index)
- docs/context/HANDOFF.md (session bridge)
- docs/context/OPEN-PROBLEMS.md (bug tracker)
- docs/context/MEMORY.md (durable decisions)
- docs/context/CONVENTIONS.md (code style)
- docs/context/SCHEMAS-INDEX.md (schema index)
- docs/context/GOTCHAS.md (bug-driven rules)
- Plans/PLAN.md (active plan)
ืืคืขืืื ืืืื: ืืืืจ ืืช ืืืฉืืื ืืจืืฉืื ื ื-Plans/PLAN.md.
Behavior contract
- Idempotent guard: REFUSES to run if
docs/context/CONTEXT-MANIFEST.md already exists
- Non-destructive: If
CLAUDE.md exists, ONLY appends a governance section โ never overwrites
- No code edits: This skill creates documentation files only
- Templates are minimal: Empty sections with clear headers. Content grows organically as the project progresses.
- Hebrew output to user. English file content.
Reference
~/.claude/docs/GOVERNANCE-AGENT-GUIDE.md ยง2 (canonical layout)
~/.claude/docs/GOVERNANCE-AGENT-GUIDE.md ยง15 (new project onboarding)
~/.claude/docs/GOVERNANCE-HUMAN-GUIDE.md (user-facing explanation)