Complete reference for Codi’s configuration system: directory structure, manifest, flags, and MCP.

Directory Structure

.codi/
  codi.yaml                    # Project manifest
  flags.yaml                   # Behavioral flags (16 flags)
  state.json                   # Generation state (auto-managed)
  mcp.yaml                     # MCP server configuration
  rules/                       # All rules (managed_by: codi or user)
  skills/
    {name}/
      SKILL.md                 # Skill definition
      scripts/                 # Skill scripts
      references/              # Reference materials
      assets/                  # Static assets
      evals/                   # Evaluation files
  agents/                      # Agent definitions (Markdown)
  brands/                      # Brand definitions (BRAND.md + assets)
  presets/                     # Installed presets
  backups/                     # Automatic backups (max 5)
  hooks/
    codi-skill-tracker.cjs     # InstructionsLoaded hook (Claude Code)
    codi-skill-observer.cjs    # Stop hook (Claude Code + Codex)
  .session/
    active-skills.json         # Per-session skill tracking (auto-managed)
  feedback/
    {timestamp}-{artifact}-{id}.json  # One file per collected observation
  operations-ledger.json       # Audit trail of all CLI operations

Manifest (codi.yaml)

The manifest declares your project name, target agents, and optional settings.

name: my-project
version: "1"

# Which agents to generate config for
agents:
  - claude-code
  - cursor
  - codex
  - windsurf
  - cline

# Pin minimum Codi version
codi:
  requiredVersion: ">=2.0.0"

# Control which content types are included in generation
layers:
  rules: true       # default: true
  skills: true      # default: true
  agents: true      # default: true
  context: true     # default: true

# Presets to load (applied in order)
presets:
  - balanced

Manifest Fields

FieldTypeRequiredDefaultDescription
namestringYesProject name (alphanumeric + hyphens)
version1YesManifest version (always 1)
descriptionstringNoProject description
agentsstring[]NoAgent IDs to generate for
layersobjectNoToggle content types
layers.rulesbooleanNotrueInclude rules in generation
layers.skillsbooleanNotrueInclude skills in generation
layers.agentsbooleanNotrueInclude agents in generation
layers.contextbooleanNotrueInclude context in generation
presetsstring[]NoPresets to load (order matters)

Flags (flags.yaml)

Flags control how AI agents behave in your project. Each flag has a mode and a value.

security_scan:
  mode: enforced
  value: true
  locked: true          # Prevents overriding

type_checking:
  mode: conditional
  value: strict
  conditions:
    agent: [claude-code]       # Only apply for this agent
    file_pattern: ["src/**/*.ts"]  # Only apply to these files

All Flags

FlagTypeDefaultHookDescription
auto_commitbooleanfalseAutomatic commits after changes
test_before_commitbooleantruetestsRun tests before commit
security_scanbooleantruesecret-detectionMandatory security scanning
type_checkingenumstricttypecheckType checking level
require_testsbooleanfalseRequire tests for new code
allow_shell_commandsbooleantrueAllow shell command execution
allow_file_deletionbooleantrueAllow file deletion
lint_on_savebooleantrueLint files on save
allow_force_pushbooleanfalseAllow force push to remote
require_pr_reviewbooleantrueRequire PR review before merge
mcp_allowed_serversstring[][]Allowed MCP server names
require_documentationbooleanfalsedoc-checkRequire documentation for new code
doc_protected_branchesstring[]["main","develop","release/*"]doc-checkBranch patterns requiring documentation verification
allowed_languagesstring[]["*"]Allowed programming languages
progressive_loadingenummetadataSkill inlining strategy for single-file agents
drift_detectionenumwarnDrift detection behavior
auto_generate_on_changebooleanfalseAuto-generate on config change

Flags with a Hook value create pre-commit checks that enforce the flag at commit time.

Flag Modes

Each flag supports 6 modes that control behavior across the inheritance chain:

ModeBehaviorCan Override?
enforcedAlways active, non-negotiableNo (stops resolution)
enabledActive with specified valueYes
disabledExplicitly turned offYes
inheritedSkip — use parent layer’s valueYes
delegated_to_agent_defaultUse the flag’s catalog defaultYes
conditionalApply only if conditions matchYes

Conditional Flags

The conditional mode requires a conditions block with at least one key:

require_tests:
  mode: conditional
  value: true
  conditions:
    agent: [claude-code]           # Match by agent
    file_pattern: ["src/**/*.ts"]  # Match by file glob

All specified conditions must match for the flag to apply.

Locking Flags

Flags can be locked at the repo level to prevent overrides:

security_scan:
  mode: enforced
  value: true
  locked: true

Attempting to override a locked flag produces a validation error.

Flag-to-Instruction Mapping

Flags are automatically translated into natural-language instructions in generated files:

FlagTrigger ValueGenerated Instruction
allow_shell_commandsfalseDo NOT execute shell commands.
allow_file_deletionfalseDo NOT delete files.
require_teststrueWrite tests for all new code.
allow_force_pushfalseDo NOT use force push (—force) on git operations.
require_pr_reviewtrueAll changes require pull request review before merging.
require_documentationtrueWrite documentation for all new code and APIs.

Operational flags (drift_detection, progressive_loading, auto_generate_on_change) control Codi’s behavior and do not generate agent instructions.


Configuration Layers

Configuration is resolved from presets and the project’s .codi/ directory:

LayerSourceDescription
PresetBuilt-in or installed presetsApplied at install time
Repo.codi/ directoryProject-level configuration (source of truth)
User~/.codi/user.yamlPersonal preferences (never committed)

MCP Configuration

Define MCP servers in .codi/mcp.yaml:

servers:
  github:
    command: npx
    args: ["-y", "@anthropic-ai/mcp-server-github"]
    env:
      GITHUB_TOKEN: "${GITHUB_TOKEN}"

  memory:
    command: npx
    args: ["-y", "@anthropic-ai/mcp-memory-server"]
    enabled: false   # Disable without removing

MCP Server Fields

FieldTypeDescription
type"stdio" or "http"Server transport type
commandstringCommand to start the server
argsstring[]Command arguments
envRecordEnvironment variables
urlstringHTTP URL (for http type)
headersRecordHTTP headers (for http type)
enabledbooleanToggle server on/off (default: true)

Built-in MCP Server Templates

33 server templates available via codi add mcp-server <name>, organized into three categories:

CategoryExamples
officialgithub, anthropic-docs, memory, filesystem, fetch
vendorneon-cloud (HTTP), graph-code, chrome-devtools, openai-developer-docs
communityVarious community-contributed servers
codi add mcp-server github --template github

Output Locations

MCP config is distributed to each agent in its native format:

AgentConfig File
Claude Code.mcp.json
Cursor.cursor/mcp.json
Codex.codex/config.toml

Hooks (Heartbeat Feedback Loop)

codi generate writes two hook scripts to .codi/hooks/ and registers them automatically in the agent’s settings file. You do not configure hooks manually.

Claude Code — .claude/settings.json

settings.json is always generated. It contains:

{
  "hooks": {
    "InstructionsLoaded": [
      {
        "type": "command",
        "command": ".codi/hooks/codi-skill-tracker.cjs",
        "timeout": 5,
        "async": true
      }
    ],
    "Stop": [
      {
        "type": "command",
        "command": ".codi/hooks/codi-skill-observer.cjs",
        "timeout": 15
      }
    ]
  }
}

If you need personal hooks that run alongside Codi’s, add them to .claude/settings.local.json. Claude Code auto-merges that file with settings.json at startup. Never edit settings.json directly — it is overwritten by codi generate.

Codex — .codex/hooks.json

Codex has no InstructionsLoaded event. Only the Stop observer is wired:

{
  "Stop": [
    {
      "type": "command",
      "command": ".codi/hooks/codi-skill-observer.cjs",
      "timeout": 15
    }
  ]
}

What the hooks do

Hook scriptTriggerAction
codi-skill-tracker.cjsInstructionsLoadedRecords which Codi skills loaded in this session to .codi/.session/active-skills.json
codi-skill-observer.cjsStopReads the transcript, extracts [CODI-OBSERVATION: ...] markers, writes feedback JSON to .codi/feedback/

See the self-improvement guide for a full explanation of how the feedback loop works.