Agentic OS Init & Retrofit Guide
Bootstrap or retrofit the Agentic OS, 3-Layer Memory architecture, and multi-tool instructions in any repository.
Supports fresh setup as well as retrofitting established projects to comply with autonomous evolution standards.
Execution Flow
- Discovery & Environment Interview: Identify project stack, active AI tools (Claude, Copilot, Gemini, Codex), and package manager (uvx, marketplace, local).
- Component & Retrofit Planning: Present plan (fresh initialization vs. retrofit of existing custom skills).
- Execution: Run
init_agentic_os.py with appropriate flags (--retrofit, --sync-instructions).
- Plugin Installation Guidance: Guide installation based on user's tooling environment.
- Post-Init & Memory Validation: Verify Layer 2
wiki/, references/map-debt.md, and instruction mirrors.
Phase 1: Discovery & Tooling Interview
Identify project status (fresh setup vs. retrofit), active AI tools (Claude Code, Copilot CLI, Gemini/Antigravity, Codex, MAF), and installation preference (uvx, Claude marketplace, local).
Phase 2: Component & Retrofit Planning
Propose a component plan before execution:
- Consult retrofit-planning.md for the component initialization and retrofit matrix.
- Verify
context/control_plane.db SQLite initialization, Layer 2 wiki/ playbooks, references/map-debt.md, and Git pre-commit evolution guards.
Phase 2.5 — Mandatory Intelligent Architecture & Rule Synthesis Protocol
[!IMPORTANT]
No Blind Overwrites: The AI Agent MUST NEVER blindly replace existing architecture files (architecture.md), rules (.agent/rules/*.md), or instruction files (CLAUDE.md, GEMINI.md, AGENTS.md). This cannot be a pure rigid deterministic script — act as an intelligent context synthesizer, balancing Agentic OS principles with target project domain realities.
Follow the protocol in instruction-blending.md:
- Inspect Target Context: Read existing
architecture.md, .agent/rules/, and instruction files to discover project tech stack, constraints, and domain conventions.
- Synthesize Architecture: If
architecture.md exists, review and integrate Agentic OS substrates without disturbing system design; if absent, seed a tailored architecture blueprint.
- Blend Instructions & Rules: Retain 100% of domain logic, reconcile rules non-destructively, and inject 3-Layer Memory, Map Debt Ledger, and Pre-Completion Gate.
- Present Diff: Present proposed architectural and rule changes for confirmation before writing.
Phase 3: Execution
Run init_agentic_os.py based on mode:
- Mode A (Fresh Setup):
python3 .agents/skills/os-init/scripts/init_agentic_os.py --target <project-path> --sync-instructions
- Mode B (Retrofit Existing):
python3 .agents/skills/os-init/scripts/init_agentic_os.py --target <project-path> --retrofit
Note: In both modes, init_agentic_os.py automatically initializes context/control_plane.db with WAL mode, installs .git/hooks/pre-commit-evolution-guard, and configures the Stop turn hook.
Retrofit mode must call every scaffolding substrate explicitly — it does not inherit them from
fresh setup. The --retrofit branch in _execute_action() is a separate, independently
maintained call list from create_project_structure()'s; when modifying either, diff their two
call lists against each other explicitly rather than assuming retrofit is a subset of fresh
setup. Full history and the invariant this guards against are in references/detailed-reference.md.
Phase 4: Plugin Installation & Deployment
Provide the installation command tailored to the user's environment:
- Universal
uvx (Recommended): uvx --from git+https://github.com/richfrem/agent-plugins-skills plugin-add richfrem/agent-plugins-skills
- Claude Code Marketplace:
claude plugin add richfrem/agent-plugins-skills
- Local Source Reinstall:
python3 plugins/plugin-manager/scripts/plugin_add.py --all -y
Phase 5: Verification Checklist & System Health Check
- Verify 3-Layer Memory & Control Plane: Check
context/control_plane.db, Layer 2 wiki/index.md, and references/map-debt.md.
- Verify Multi-Tool Instruction Mirrors: Ensure
CLAUDE.md, GEMINI.md, .github/copilot-instructions.md, and AGENTS.md are aligned.
- Verify Skills & Plugin Compliance: Run
audit_skill.py on new skills; check references/evolution-log.md stubs.
- Mandatory Post-Init Health Check: Trigger
os-health-check (or Phase 3.5 substrate check); if any substrate reports MISSING, re-run with --retrofit. Check commands in references/detailed-reference.md.
Consumer Guidance & Upstream Contribution Protocol
When a bug or gap is found in an installed skill/script: prefer Workflow A (fix locally, port upstream via PR); use Workflow B (project-specific overrides in .agent/rules/local-*) for domain divergence; fall back to Workflow C (file upstream issue) if a PR isn't feasible. Full details in references/detailed-reference.md.
1---2name: os-init3plugin: agent-agentic-os4description: >5 Trigger: "set up agentic OS", "initialize agent harness", "init my project for AI agents",6 "retrofit repository", "upgrade project for evolution", "sync instruction files",7 "where do I put CLAUDE.md", "create my agent environment", "set up persistent memory".8 Guides users through discovery, initializes/retrofits 3-Layer Memory, mirrors multi-tool9 instruction files (CLAUDE/GEMINI/Copilot/AGENTS), and guides plugin installation.10allowed-tools: Bash, Read, Write, Glob, Grep11---1213# Agentic OS Init & Retrofit Guide1415Bootstrap or retrofit the Agentic OS, 3-Layer Memory architecture, and multi-tool instructions in any repository.16Supports fresh setup as well as retrofitting established projects to comply with autonomous evolution standards.1718---1920## Execution Flow21221. **Discovery & Environment Interview**: Identify project stack, active AI tools (Claude, Copilot, Gemini, Codex), and package manager (uvx, marketplace, local).232. **Component & Retrofit Planning**: Present plan (fresh initialization vs. retrofit of existing custom skills).243. **Execution**: Run `init_agentic_os.py` with appropriate flags (`--retrofit`, `--sync-instructions`).254. **Plugin Installation Guidance**: Guide installation based on user's tooling environment.265. **Post-Init & Memory Validation**: Verify Layer 2 `wiki/`, `references/map-debt.md`, and instruction mirrors.2728---2930## Phase 1: Discovery & Tooling Interview3132Identify project status (fresh setup vs. retrofit), active AI tools (Claude Code, Copilot CLI, Gemini/Antigravity, Codex, MAF), and installation preference (`uvx`, Claude marketplace, local).3334---3536## Phase 2: Component & Retrofit Planning3738Propose a component plan before execution:39- Consult [retrofit-planning.md](references/retrofit-planning.md) for the component initialization and retrofit matrix.40- Verify `context/control_plane.db` SQLite initialization, Layer 2 `wiki/` playbooks, `references/map-debt.md`, and Git pre-commit evolution guards.4142---4344## Phase 2.5 — Mandatory Intelligent Architecture & Rule Synthesis Protocol4546> [!IMPORTANT]47> **No Blind Overwrites**: The AI Agent MUST NEVER blindly replace existing architecture files (`architecture.md`), rules (`.agent/rules/*.md`), or instruction files (`CLAUDE.md`, `GEMINI.md`, `AGENTS.md`). This cannot be a pure rigid deterministic script — act as an **intelligent context synthesizer**, balancing Agentic OS principles with target project domain realities.4849Follow the protocol in [instruction-blending.md](references/instruction-blending.md):501. **Inspect Target Context**: Read existing `architecture.md`, `.agent/rules/`, and instruction files to discover project tech stack, constraints, and domain conventions.512. **Synthesize Architecture**: If `architecture.md` exists, review and integrate Agentic OS substrates without disturbing system design; if absent, seed a tailored architecture blueprint.523. **Blend Instructions & Rules**: Retain 100% of domain logic, reconcile rules non-destructively, and inject 3-Layer Memory, Map Debt Ledger, and Pre-Completion Gate.534. **Present Diff**: Present proposed architectural and rule changes for confirmation before writing.5455---5657## Phase 3: Execution5859Run `init_agentic_os.py` based on mode:6061- **Mode A (Fresh Setup)**: `python3 .agents/skills/os-init/scripts/init_agentic_os.py --target <project-path> --sync-instructions`62- **Mode B (Retrofit Existing)**: `python3 .agents/skills/os-init/scripts/init_agentic_os.py --target <project-path> --retrofit`6364*Note: In both modes, `init_agentic_os.py` automatically initializes `context/control_plane.db` with WAL mode, installs `.git/hooks/pre-commit-evolution-guard`, and configures the `Stop` turn hook.*6566Retrofit mode must call every scaffolding substrate explicitly — it does not inherit them from67fresh setup. The `--retrofit` branch in `_execute_action()` is a separate, independently68maintained call list from `create_project_structure()`'s; when modifying either, diff their two69call lists against each other explicitly rather than assuming retrofit is a subset of fresh70setup. Full history and the invariant this guards against are in `references/detailed-reference.md`.7172---7374## Phase 4: Plugin Installation & Deployment7576Provide the installation command tailored to the user's environment:77- **Universal `uvx` (Recommended)**: `uvx --from git+https://github.com/richfrem/agent-plugins-skills plugin-add richfrem/agent-plugins-skills`78- **Claude Code Marketplace**: `claude plugin add richfrem/agent-plugins-skills`79- **Local Source Reinstall**: `python3 plugins/plugin-manager/scripts/plugin_add.py --all -y`8081---8283## Phase 5: Verification Checklist & System Health Check84851. **Verify 3-Layer Memory & Control Plane**: Check `context/control_plane.db`, Layer 2 `wiki/index.md`, and `references/map-debt.md`.862. **Verify Multi-Tool Instruction Mirrors**: Ensure `CLAUDE.md`, `GEMINI.md`, `.github/copilot-instructions.md`, and `AGENTS.md` are aligned.873. **Verify Skills & Plugin Compliance**: Run `audit_skill.py` on new skills; check `references/evolution-log.md` stubs.884. **Mandatory Post-Init Health Check**: Trigger `os-health-check` (or Phase 3.5 substrate check); if any substrate reports `MISSING`, re-run with `--retrofit`. Check commands in `references/detailed-reference.md`.8990## Consumer Guidance & Upstream Contribution Protocol9192When a bug or gap is found in an installed skill/script: prefer **Workflow A** (fix locally, port upstream via PR); use **Workflow B** (project-specific overrides in `.agent/rules/local-*`) for domain divergence; fall back to **Workflow C** (file upstream issue) if a PR isn't feasible. Full details in `references/detailed-reference.md`.