AgentSkillsCN

Compile

将决策编译为人类合约、代理合约,或两者兼备。仅限明确表述。

SKILL.md
--- frontmatter
description: Compile decisions to human contract, agent contract, or both. Explicit only.
disable-model-invocation: true

/dna:compile — Compile Contracts

Compile decisions into human contract, agent contract, or both.

Usage: /dna:compile human, /dna:compile agent, /dna:compile (both)

Targets

Human Contract (contracts/human.md)

Organized by level. Narrative prose. What people agree on.

markdown
# Human Contract — [project name from .dna/config.json]

## Identity (Level 1)
[compiled from level 1 decisions]

## Direction (Level 2)
[compiled from level 2 decisions]

## Strategy (Level 3)
[compiled from level 3 decisions]

## Tactics (Level 4)
[compiled from level 4 decisions]

For each level section:

  1. Read all committed decisions at that level
  2. Weave into coherent narrative — decisions, reasoning, tradeoffs
  3. Note any suggested decisions as "Under consideration: ..."
  4. Include key Detail sections inline where they ground the narrative

Agent Contract (contracts/agent.md)

Structured for agent consumption. Constitution + project decisions.

markdown
# Agent Contract — [project name from .dna/config.json]

## Principles
[from constitution decisions]

## Boundaries
[assumptions + constraints from all levels]

## Authority
[what's autonomous vs HITL — from stakes + tradeoffs]

## Context
[key decisions the agent needs, with Detail inline]

## Rules
[concrete enforcement rules from high-stakes decisions]

What to do

  1. Completeness analysis: Run dna-graph progress --json to assess graph health before compilation. If foundation is thin (level 1-2 gaps), warn the person before proceeding.

    sh
    CLAUDE_PROJECT_DIR="$PROJECT_DIR" python3 "$TOOL" progress --json
    
  2. Read .dna/config.json to get the project name for contract headers

  3. Get the deterministic compilation skeleton:

    sh
    CLAUDE_PROJECT_DIR="$PROJECT_DIR" python3 "$TOOL" compile-manifest --target {target} --json
    
  4. Read decisions listed in the manifest (not all decisions — the manifest provides the exact set)

  5. Sort by level, then by dependency order within level

  6. Compile the target contract(s) following the structure above

  7. Present compiled output for human approval

  8. Write to contracts/ on approval

Constraints

  • Never invent content not grounded in decisions
  • If a decision's state is suggested, mark it clearly in the output
  • Respect the iron rule: committed language only for committed decisions
  • Include <!-- Compiled from: DEC-001, DEC-003, ... --> comments per section

Context

  • Constitution: constitution/ directory
  • DNA: dna/ directory
  • Contracts: contracts/ directory
  • Project config: .dna/config.json
  • All commands via Bash: CLAUDE_PROJECT_DIR="$PROJECT_DIR" python3 "$TOOL" <command>
  • Tool path is available from session-start output (## Tool Paths section)
  • Format spec: see format.md in the dna plugin