agence

CODEX: LAWS

4 Immutable Prohibitions

Violation = Immediate Abort. No Exceptions.


Law 1: Never Skip CODEX

# ✅ LEGAL: Through agence
agence @claudia "Design a system"

# ❌ ILLEGAL: Bypasses CODEX
claude "Design a system"
git -C /parent/repo commit -m "agence knowledge"  # Never!

Law 2: Never Auto-Destroy

# ❌ ILLEGAL: Auto-delete
agence /merge feature-branch  # Don't delete feature-branch after!

# ✅ LEGAL: Keep and ask
agence /merge feature-branch
# → Branch kept, user decides later
agence ^branch-delete feature-branch  # Explicit deletion

---

## Law 3: Do Not Repeat Faults

- Track what failed and why
- Never make the same mistake twice
- Learn from errors permanently

```bash
# Maintain: mistakes.log or fault tracking
# Query: "Have we seen this error before?"
# Action: Prevent recurrence

Law 4: Do Not Lie. Disclose Errors Early.


Version: 0.1.0
Status: In Effect
Last Updated: 2026-03-04


Law 5: Sessions Stay Local, Metadata Shared

Local session persistence (.aisessions/) is for agent debugging and recovery only.


# ❌ ILLEGAL: Push raw session data
git add .aisessions/*.typescript
git commit -m "aisession logs"

# ✅ LEGAL: Export metadata for handoff
jq '.exit_code, .lessons, .fault' < .aisessions/AISESSION_ID.meta.json > /tmp/handoff.json
# Share /tmp/handoff.json, never .typescript

See SESSION-PERSISTENCE.md for details.



# ✅ LEGAL: Surgical edit (add to existing list)
APT_CORE+=("gawk" "npm" "curl")

# ❌ ILLEGAL: Replace entire list (drops existing entries)
APT_CORE=("gawk" "npm" "curl")  # Where did jq, gh, tmux go?

# ✅ LEGAL: Ask before removing
# "This will remove terraform, azure-cli, awscli. Proceed? [y/N]"

# ❌ ILLEGAL: Silent removal
# Rewrite file without mentioning dropped content

Law 7: Upstream Actions Require Review


Law 8: Path Validation (Security Layer)

Path Resolution (Validation Layer)

# ✅ LEGAL: Validate using resolved path
resolved=$(realpath "$user_path")
if [[ "$resolved" == "$allowed_root"* ]]; then
  proceed
else
  reject "Out of scope: $resolved vs $allowed_root"
fi

# ❌ ILLEGAL: String normalization in security layer
if [[ "${user_path//\\\//}" == "$allowed_root" ]]; then  # Wrong!
  proceed
fi

# ❌ ILLEGAL: Auto-create junctions to "fix" scope
mklink /J "$broken_path" "$canonical_path"  # Never!

Symbol Scope Constraints

# ✅ LEGAL: Hierarchical symbol use
***&task@ralph          # Priority + state + agent routing
*+task                  # Priority + pending state
%task@ralph             # Agent in-progress

# ❌ ILLEGAL: Wrong scope
~task@ralph             # Swarm symbol in agent code (v0.2.3)
$task                   # Swarm symbol without context
@ralph%task             # Routing in wrong position

Version: 0.2.3.1
Status: In Effect
Last Updated: 2026-03-31