---
title: "Agent Policies"
type: reference
kind: reference
documentedFor: "1.24.1"
updated: "2026-11-19"
canonical: "https://arcaneai.net/docs/reference/agent-policies"
---

# Agent Policies

## At a glance

| Field | Value |
| --- | --- |
| Status | active |
| Audience | both |
| Tags | `agent`, `policy`, `security` |

Defines what agents are and are not authorized to do when operating in this environment.

## Executive Summary

- Agents are constrained operational tools, not autonomous business decision-makers.
- The baseline model is least privilege: non-root execution, scoped workspace, and explicit prohibited actions.
- A hardening backlog defines the path from baseline safeguards to production-grade controls.
- Use this file as the normative policy reference for agent behavior boundaries.

---

## Execution Model

Agents run inside an agent runtime (your orchestrator) that mediates model inference, tool access, and inter-agent coordination. Agent autonomy is governed by per-agent, per-repo power levels (see the power-level matrix below).

| Property              | Generic Baseline                                                          |
| --------------------- | ------------------------------------------------------------------------- |
| Runs as               | A dedicated non-root user — **never root**                                |
| Model inference       | Provider-agnostic; configure one or more model providers as needed        |
| Tools profile         | Scoped to the minimum needed (e.g. shell, file read/write, web fetch)     |
| Agent workspaces      | Each agent gets an isolated workspace directory                           |
| Agent-to-agent        | Orchestrators may spawn subagents; specialist/leaf agents may not         |
| Conversation scope    | Isolated per-channel/peer conversation contexts                           |

> **Supported clients (examples):** the runtime may front a variety of agent clients — GitHub Copilot, Claude Code, Codex, and others. Do not assume a single deployment; configure for the clients you actually use.

---

## Per-Repo Power Level Matrix

Agent autonomy is gamified into ascending power levels. Each level grants broader authority:

| Level     | Authority                                                                  |
| --------- | -------------------------------------------------------------------------- |
| Spectator | Human-only. No autonomous action (e.g. repo creation).                     |
| Apprentice | Read and propose; changes queued for human merge.                         |
| Wizard    | Scoped autonomous edits in approved paths; PRs queued for review.          |
| Sorcerer  | Autonomous topic-branch work; PRs queued for review.                       |
| Magus     | Self-merge within approved scope (never squash).                           |
| Archmage  | Broadest autonomous authority within an approved repo.                     |

Assign a default power level per agent × per repo. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — no check verifies a level was assigned for every agent × repo pair.** Human approval and commit governance still apply in interactive sessions; Temporary Run Grants below provide an action-specific alternative when explicitly authorized ([ARC-061](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-061--scoped-temporary-run-grants-unattended-preflight-and-authority-accounting)). **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-commit-work`'s execution-authority table requires exact operator approval for any interactive-context commit regardless of power level, gated by an approval-fingerprint check before `git commit` runs.**

**Notes:**

- Repo creation remains Spectator-level (human only), regardless of an agent's assigned power level.
- Grant the lowest level that lets an agent do its job; promote only after an autonomous fix-verify loop is validated for that agent.

**Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — both notes are operating conventions with no code check for repo-creation gating or promotion timing.**

---

## Interactive approval belongs to the acting session

The operator gives interactive approval in the session that will execute the action. This applies to commits, pushes, pull request creation and reviewer assignment, votes, and completion. A handoff can carry a plan, approval evidence for work already executed, and the action awaiting a decision. The receiving session must obtain its own approval before acting. A scoped run grant follows its separate provenance, action, checkout, and expiry checks.

## Solo-Operator Delegation Records (No Roster)

The Per-Repo Power Level Matrix above assumes an installed agent roster (`.arcane/agents.yaml`) — each
agent has a slug and a per-repo power level, and that's where standing authority lives. A repo with **no
roster installed at all** has nowhere in that model to record a delegation, so one tends to get granted
ad hoc — free prose in whatever document is at hand — and then forgotten, since nothing lists it.

For exactly this case, record the grant explicitly instead, in `.arcane/delegations.json`:

```json
{
  "delegations": [
    {
      "id": "short-identifier",
      "grantedBy": "operator (name)",
      "grantedAt": "YYYY-MM-DD",
      "scope": "What this delegation covers — be specific, not 'everything'",
      "permittedActions": ["create-session-branches", "commit", "push", "..."],
      "excludedActions": ["platform-settings-mutations", "..."],
      "status": "active",
      "revocation": "Edit or remove this entry and commit."
    }
  ]
}
```

- **Explicit:** a structured, git-tracked file — not prose buried in an unrelated document. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — nothing prevents an ad hoc delegation from still being written as free prose elsewhere; using this file is a recommended convention, not a checked requirement.**
- **Listable:** `spell doctor` reads this file (when present) and reports every active delegation's
  scope and exclusion list. A missing file is a silent pass — a repo with no ad hoc grants has nothing
  to report.
- **Revocable per repo:** revocation is the git-native act of editing or removing the entry and
  committing — set `status` to `"revoked"` or delete the entry outright. **Enforcement: executable check ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `checkDelegations` (`src/commands/doctor.ts`) reads `.arcane/delegations.json` and reports only entries with `status === "active"`, so a revoked entry silently drops out of `spell doctor`'s report; it verifies visibility, not the legitimacy of the scope itself.**
- **Grants no new authority.** This mechanism does not permit anything `agent-policies.md` didn't
  already allow in principle (human execution required absent an explicit grant) — it only makes an
  existing kind of ad hoc grant explicit and discoverable instead of buried.
- **No scaffold is shipped.** A delegation record is inherently repo-specific and starts empty for a
  fresh install — there is nothing generic to seed.
- **Does not replace the roster-based matrix.** A repo with an installed roster still uses per-agent
  power levels for standing authority; this is the parallel, lighter-weight path for repos without one. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — these notes describe the mechanism's scope; legacy delegation entries are shape-checked for display, but their free-form scope/actions do not authorize execution; the separate Temporary Run Grants below have runtime validation.**

---

## Temporary Run Grants (ARC-061)

An operator present in an interactive session may authorize a bounded unattended
run without changing roster power or pretending the session is autonomous. This
is distinct from the legacy standing `delegations` above: add `runGrants` beside
that array in `.arcane/delegations.json`. It works with or without a roster.

```json
{
  "delegations": [],
  "runGrants": [{
    "id": "example-run",
    "grantedBy": "operator",
    "operatorWords": "Implement task-1, commit, push, create its PR and complete it after checks pass.",
    "grantedAt": "2026-11-05T08:00:00.000Z",
    "expiresAt": "2026-11-06T08:00:00.000Z",
    "scope": {
      "repository": "github.com/example/project",
      "task": "task-1",
      "branchPrefix": "sessions/2026-11-05-task-1"
    },
    "permittedActions": ["commit", "push", "create-pr", "complete-pr"],
    "excludedActions": ["approve-pr", "run-dev-pipeline"],
    "requiredChecks": ["lint", "typecheck", "test", "build"],
    "status": "active",
    "revocation": "Set status to revoked or remove this entry; commit the change."
  }]
}
```

- **Scope and lifetime:** repository and task match exactly. Derive repository
  identity from the observed remote (for GitHub, `github.com/<owner>/<repo>`;
  for ADO, `dev.azure.com/<org>/<project>/_git/<repo>`), not from the grant.
  Use canonical UTC ISO timestamps with milliseconds. Expiry must be after grant
  time, is exclusive, and is checked again before each action. The branch must
  equal `branchPrefix`, or extend it at `-` or `/`; a prefix already ending in
  one of those delimiters matches directly. Exclusions override permissions.
- **Explicit actions:** only `commit`, `push`, `create-pr`, `assign-pr`,
  `approve-pr`, `complete-pr`, `delete-remote-branch`, `run-dev-pipeline` are
  recognized in `permittedActions`. Unknown permitted actions fail validation;
  exclusions may also name never-permitted operations such as `force-push`,
  `production-deploy` and `settings-change`. Completion needs `complete-pr`
  and a nonempty list of required check names. Check names are evidence labels,
  never command text to execute; resolve actual checks from the approved plan.
  A commit-only grant cannot complete a PR. No action grants force-push, settings
  changes, production deployment or permission to delete unmerged work.
- **Consent and bootstrap:** record the operator's words verbatim while present,
  including their authorization to commit the grant record. Apply the existing
  exact approval gate to that commit unless the operator explicitly authorizes
  recording and committing this scope. A file or tool match cannot prove consent.
  Agents never mint, renew, widen or backdate their own authority. Later evidence
  cannot authorize a past action. The run ends on completion even if time remains.
- **Additive path:** a matching, active grant supplies only the named action's
  authority, including in a rosterless or below-Magus interactive session. The
  default fingerprint/PR-bound/Magus paths elsewhere in this document remain for
  actions without a matching grant. Explicit `exec_allowed: false` remains a
  denial; a present roster that cannot be validated also stops execution. A grant
  does not change standing power or global tool/MCP configuration.
- **Platform gates stay:** push policy, required checks, review rounds, independent
  reviewers, provider permissions and allowed merge methods still apply. Revalidate
  the exact PR head and required checks before completion; a head change invalidates
  prior check evidence. GitHub PR authors cannot approve their own PR. Azure DevOps
  creator voting depends on policy. Neither is bypassed by `approve-pr` permission.
- **Visibility and terminal states:** `spell doctor` lists active grants with expiry.
  Expired, future, revoked and ended records are inactive. Record successful closeout
  as `ended` in the final delivery change. Use `revoked` for operator withdrawal, or
  remove the withdrawn record. Both terminal statuses deny every action. Existing standing-delegation output is preserved. No generic
  grant is installed, and a grant is not silently seeded from a roster or chat.
- **Per-action evidence:** print `Acting under grant <id>: <action> PR <id> @ <head SHA>`
  (branch/head for a commit or push), record the resulting commit, and retain it
  for close-session's Authority used table. A missing/invalid/expired/revoked/ended or
  out-of-scope grant uses the existing visible authorization downgrade. Auto-merge
  cannot remain armed past expiry; monitor/cancel it, or wait for checks and then
  revalidate before direct completion. Grant-file edits remain scoped and do not
  themselves renew authorization.

`spell grant check --id <id> --repository <repository> --task <task> --branch <branch> --action <action>`
returns JSON and exits 0 for a matching record, 1 otherwise. It writes nothing and
never executes grant content. **Enforcement: executable check ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts))** — the
shared `run-grants.ts` validator evaluates shape, action, time and scope; doctor
only displays it. **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts))** — the shared
run-grant fragment verifies operator provenance, execution denials, head-bound
checks, per-action evidence and completion restrictions. This is a prompt-governed
authority path, not a signed capability or a privileged execution boundary.

Related: `DECISIONS.md`, [Spell — Full Cycle](/docs/reference/spell-full-cycle).

---

## Agent-to-Agent Topology

Spawn rights are configured per agent. Use a small number of orchestrators; keep most agents as leaf nodes that cannot spawn subagents.

- **Orchestrators** delegate work to specialists and aggregate their results.
- **Leaf nodes** perform a single role (development, QA, research, comms) and report results upward; they cannot spawn subagents.
- Promote a leaf to an orchestrator only once its autonomous behavior is validated. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spawn.can_spawn`/`spawn.spawnable_by` are schema-validated fields (`src/modules/agent-schema.ts`) when an agent definition declares them, but that only checks the declared value's shape; no code in this repo verifies a runtime actually honors the leaf/orchestrator split.**

---

## MCP Integration

Agents may integrate external tools and services through MCP (Model Context Protocol) servers.

**Permission model:** Keep write operations in an approve-all (human-approval) mode. Unattended write calls should fail closed (deny) rather than execute silently.

**Per-agent scoping:** Where the runtime cannot scope MCP servers per agent, enforce boundaries through spawn rights (orchestrators control task assignment) and filesystem scope (see the approved-paths registry for your deployment).

**Access boundaries:** An agent may be intentionally denied access to one org/service while retaining access to another (a least-privilege split). Verify the split behaves as expected — the denied target should return an unauthorized error.

**MCP change control rule:** Never enable a fully automatic write mode. Adding a new MCP server (new org, new service, new auth pattern) is a **Medium**-risk change — it requires explicit approval and a recorded decision if it changes the agent's reachable network surface. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell doctor`'s `checkMcpConfig` only validates that a configured `.mcp.json` server declares a numeric timeout; it does not check write-mode, per-agent scoping, access boundaries, or new-server change-approval.**

---

## Guiding Principle

An agent is operational infrastructure. It executes defined tasks. It does not make business decisions, handle financial transactions without explicit approval, or access systems outside its defined scope. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — a framing statement of intent with no independent mechanical check; the specific prohibitions it summarizes are enforced (or not) where they recur below.**

---

## Remote Change Control

When agents can be driven through remote channels (chat, messaging, CLI, IDE), apply the same governance quality expected in interactive editor sessions.

### Role Split (Default)

- A front-door orchestrator captures and triages remote requests.
- A designated privileged executor handles high-risk runtime/config changes.
- The orchestrator may execute low-risk documentation-only updates directly in approved paths. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — this role split is an operating convention for remote-channel work with no code that checks it was followed.**

### Required Workflow

Every remote environment change follows this sequence:

1. **Request capture** — restate the requested change and intended outcome.
2. **Risk class assignment** — classify as low/medium/high before execution.
3. **Approval gate** — obtain explicit human approval before apply.
4. **Pre-change backup** — snapshot relevant config/artifacts before mutation.
5. **Apply** — execute the scoped change (delegate high-risk to the privileged executor).
6. **Verify** — run deterministic checks and report results.
7. **Document** — update canonical docs (policy/runbook/journal/TODO/decisions as needed). **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — steps 1–7 are a general change-management sequence with no dedicated spell or check verifying each step ran.**
8. **Commit proposal** — prepare a commit message and request explicit approval. **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-commit-work` Step 8 computes an approval fingerprint from the staged diff and proposed message and requires an authenticated operator response tied to that fingerprint before `git commit` runs.**

### Risk Classes

| Class  | Examples                                                                                  | Executor                                      |
| ------ | ----------------------------------------------------------------------------------------- | --------------------------------------------- |
| Low    | Doc-only updates, journal entries, decision/TODO edits, read-only diagnostics             | Orchestrator                                  |
| Medium | Runtime policy edits, channel allowlist changes, agent routing updates                    | Orchestrator, with explicit approval          |
| High   | Auth boundary changes, gateway security settings, privileged tool-scope expansion         | Privileged executor (delegated), then reported back |

### Evidence Requirements (Remote Sessions)

Each completed remote change should preserve traceability by recording:

- request and session identifiers
- channel
- acting agent and delegated executor (if any)
- change scope and risk class
- approver identity and timestamp
- backup reference
- verification outcome
- rollback reference
- links to updated docs and the proposed/approved commit

When evidence cannot be captured in a single step, queue a TODO immediately and mark the change as partially complete. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — a recommended record-keeping checklist with no code that verifies any of these fields were actually captured.**

### Commit Hygiene for Remote Changes

- **Author identity:** commits are authored under the human owner's identity (`{OPERATOR_EMAIL}`).
- **Agent identity:** record the acting agent (`{AGENT_NAME}`) and the model/provider used.
- Use Conventional Commits format: `type(scope): description`. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — these three conventions are generated by `spell-commit-work`'s message-drafting steps, but nothing rejects a commit that skips them; `git-conventions.md` itself notes the format regex is "optional — not enforced by hooks."**
- Show the full proposed commit and obtain approval before executing `git commit`. **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — the same `spell-commit-work` Step 8 approval-fingerprint gate cited above.**

---

## Autonomy Behavior: Discover-Then-Escalate (In-Scope Only)

To reduce friction without weakening security, agents must follow this behavior when asked to inspect code:

1. If the requested repo/path is under an approved root, attempt read-only discovery first.
2. Use non-destructive checks (`ls`, `find`, file reads, git metadata reads) inside approved roots.
3. Only request operator clarification after in-scope discovery fails.
4. Never probe paths outside approved roots.

**Intent:** fail-closed on boundaries, but avoid unnecessary "no access" responses for already-approved locations. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — this discovery-before-escalation sequence and the approved-root boundary are behavioral guidance with no check in this repo verifying an agent stayed within them.**

---

## Repo Context Bootstrap Requirement

Before meaningful autonomous work in any newly cloned repo, agents must verify context artifacts exist (or create a task to add them):

- `README.md` (or equivalent project orientation)
- `CLAUDE.md` and/or `.github/copilot-instructions.md` (agent instruction surface)
- Any project-local contribution/architecture guidance docs

**Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell doctor`'s `checkSessionContinuity` verifies a different file set (`TODO.md`, `DECISIONS.md`, `ai-context/system-prompt-context.md`, `journal/.gitkeep`, for `spell-close-session`) and does not check for `README.md`/`CLAUDE.md`/contribution docs, so this bootstrap requirement has no executable backing.**

---

## Actionable Recommendation Policy

Any recommendation that could lead to a **monetary cost, account creation, subscription, purchase, license, or irreversible action** must follow these guardrails. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — this entire policy (the classification tiers, the six guardrails below, and the worked examples) depends on model judgment at generation time; no code in this repo checks that a recommendation was flagged, verified, or confirmed.**

### Classification

| Tier              | Trigger                                                                                                  | Requirement                                   |
| ----------------- | -------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| **Informational** | No cost or commitment implied                                                                            | None — provide the recommendation normally    |
| **Actionable**    | Could lead to spending money, creating accounts, signing up for services, or making irreversible changes | Apply all guardrails below                    |
| **High-Stakes**   | Significant cost (>$50), long-term contracts, or decisions that are difficult to reverse                 | Apply guardrails + explicit confirmation gate |

### Guardrails for Actionable & High-Stakes Recommendations

1. **Flag it explicitly.** State clearly: _"This recommendation would involve a purchase/subscription/commitment."_ Never let a recommendation lead to a spending decision without the operator knowing.

2. **Verify before recommending.** When evaluating real-world tools, products, or services:
   - Use current, verifiable information — **never assume** capabilities, pricing, or features.
   - If unable to verify, say so: _"I cannot confirm the current state of [X] — verify before purchasing."_
   - Never fabricate product comparisons or capability rankings from stale training data.

3. **Present alternatives including free/no-cost options.** Always include at least one zero-cost alternative when one exists.

4. **State confidence level.** If the recommendation is based on general knowledge rather than verified current data, say so explicitly: _"Based on general knowledge (not verified as of today)."_

5. **Confirmation gate for High-Stakes.** For >$50 or contract commitments, require explicit operator confirmation before proceeding. Format:

   > ⚠️ **This would involve [cost/commitment].** Alternatives: [list]. Confirm before proceeding.

6. **Consider downstream implications.** Before recommending any tool, service, or approach, evaluate:
   - Does this require a paid subscription or license?
   - Is there a free tier or alternative that achieves the same goal?
   - Is this reversible if it doesn't work out?
   - What is the operator likely to do with this recommendation?

### What This Means in Practice

- Recommending a paid image-generation service over one the operator already has access to? **Flag the cost and name the no-additional-cost alternative.**
- Suggesting an npm package vs a built-in solution? Informational — no cost gate needed.
- Recommending a cloud service tier? **High-Stakes** — present pricing, alternatives, and require confirmation.

---

## Permitted Actions

Permitted actions are agent- and deployment-specific. As a baseline, an agent may:

- Read and write within its own approved workspace.
- Generate content (listings, copy, documentation) for human review.
- Read and write to designated business data directories when explicitly configured.
- Read, flag, and queue operational workflows — never execute irreversible actions (fulfillment, publishing, payment) without approval.

Define the concrete permitted-actions list per agent in that agent's configuration. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `tools.allowed`/`tools.denied` are schema-validated when present (`src/modules/agent-schema.ts`) but declaring them is optional, and nothing in this repo verifies a runtime actually restricts an agent to its declared list.**

---

## Prohibited Actions

- Executing commands with root/elevated privileges (agents run as a dedicated non-root user).
- Accessing any directory outside the agent's designated scope.
- Making financial transactions without explicit human approval.
- Accessing credential stores or password managers.
- Sending external communications (email, social posts) without a human review queue.
- Modifying security-relevant configuration without human approval.
- Using personal Git credentials or SSH keys — agents must use scoped, dedicated credentials.

**Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — this deny list describes deployment/runtime hardening expectations; no check in this repo's own code observes agent process privileges, filesystem access, or credential usage at execution time.**

---

## Escalation Rules

If an agent encounters a situation outside its defined parameters, it should:

1. Stop the current action.
2. Log the situation with full context.
3. Queue for human review.
4. Not attempt to resolve ambiguity autonomously.

**Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — a behavioral sequence with no code that verifies an agent actually stopped, logged, or queued for review.**

---

## Branch Discipline

**Agents must never commit directly to main. Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-commit-work` Step 1 checks the current branch and stops before staging or committing if `main`/`master` is checked out against a usable remote, requiring a compliant topic branch first.** All work happens on topic branches. This prevents collisions when multiple agents or human operators work in parallel.

**Required workflow for all agents:**

1. **Create a topic branch** before making any changes:

   ```bash
   git checkout -b {your-slug}/type/short-description origin/main
   ```

   Example: `lafayette/feat/api-endpoint`, `merlin/docs/architecture-update`

2. **Commit** with proper attribution (author identity + required trailers per your git conventions). **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-commit-work` Steps 1, 4.5, and 8 gate this: Step 1's branch guard, Step 4.5's loader-validated execution-authority check, and Step 8's approval-fingerprint requirement before `git commit` executes.**

3. **Sync with main before opening a PR** — always fetch and rebase on the latest `origin/main` before pushing or creating a PR, even if you think no one else has merged:

   ```bash
   git fetch origin
   git rebase origin/main
   # If conflicts arise: resolve each file → git add <file> → git rebase --continue
   # If rebase is unrecoverable: git rebase --abort, report to operator
   ```

   **Rule:** Never open a PR against a base that is ahead of your branch. Never push a branch with unresolved conflicts. Resolve locally — the PR must be clean and CI-green before review. **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-create-pull-request` Step 0's mandatory rebase guard (its Step 0.6) and `spell-commit-work` Step 9b both require a clean `git fetch origin && git rebase origin/<target>` before any PR-creation call, stopping for human resolution on conflict.**

4. **Push the branch** to origin (after rebase).

5. **Merge or queue** based on your power level — and merge by the mechanism your repository type and isolation primitive allow ([ARC-009](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-009--session-naming-and-pr-lifecycle-reliability-policy) §7, [ARC-028](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-028--concurrency-and-isolation-model-for-parallel-work) R1):
   - **Magus+ power level, in a code repository:** self-merge by completing the PR on the platform, by rebase and fast-forward or merge without fast-forward, never squash ([ARC-009](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-009--session-naming-and-pr-lifecycle-reliability-policy) §7). A code repository requires a PR and rejects direct pushes to `main` (`git-conventions.md` → Merge Strategy by Repo Risk), so this holds in every working tree. **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-commit-work` Step 9 completes a PR only by merge (no fast-forward) or rebase and fast-forward, with squash disabled; the refusal of a direct push to `main` is the platform's branch protection, which no Arcane code path verifies.**
   - **Magus+ power level, in a docs-only repository's primary checkout:** self-merge via `git merge --ff-only`, push main, delete branch.
   - **Magus+ power level, in a linked worktree or a clone:** self-merge through the platform's PR merge instead. The authority is identical; only the mechanism changes, because a local ff-merge requires checking out `main` and another working tree already holds it. Power level decides *whether* you may merge without review; the isolation primitive decides *how*.
   - **Below Magus:** push the branch, report the branch name, and queue for human merge. **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-commit-work`'s execution-authority table and its Step 9 merge-authorization gate (and `spell-create-pull-request`'s Authorization Gate) resolve power level and `exec_allowed` through the EF-27 loader-validated roster before permitting self-merge; below-Magus or unresolved authority always downgrades to human completion.**

6. **Delete the branch** (local and remote) after merge. **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-commit-work` Step 10 and `spell-close-session`'s branch-deletion step both require running the Same-Vantage-Point Check before a worktree-adjacent deletion; the vantage-point determination itself remains a manual judgment call, which `git-conventions.md` discloses as "not a code-level gate."**

**Branch naming format:** the autonomous roster-agent form of the branch-naming rule in `git-conventions.md` → Branch Naming, stated once there and not restated here. The agent-slug prefix makes ownership obvious and prevents naming collisions.

- Use standard commit types: `feat`, `fix`, `docs`, `refactor`, `chore`, etc. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — no check in this repo validates an autonomous agent's branch name against that rule; the rename gate in `git-conventions.md` → Branch Naming runs only in interactive sessions.**

**What happens if ff-only fails** (a docs-only repository's local merge): Another actor merged to main first. This should not happen if you followed step 3. If it does, rebase and retry — **from the primary checkout**, since this block checks out `main`:

```bash
git fetch origin
git rebase origin/main
git checkout main
git merge --ff-only {your-slug}/type/short-description
```

From a linked worktree or a clone, stop after the rebase and merge through the platform's PR instead ([ARC-028](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-028--concurrency-and-isolation-model-for-parallel-work) R1). `git checkout main` there fails with `fatal: 'main' is already used by worktree at '<path>'`.

### Multi-Agent Concurrency Rules

When more than one agent may work in the same repository simultaneously:

1. **One agent per feature branch.** A feature branch is its owner's exclusive territory. No other agent reads from or writes to it without explicit handoff from the operator.
2. **Feature folders follow branches.** A `features/{id}-{slug}/` directory is owned by the agent whose branch name contains `{id}-{slug}`. Other agents must not modify another agent's active feature folder.
3. **Stale branch detection.** Before creating a new branch, fetch and check for an existing branch for the same work item; if one exists, report it rather than creating a duplicate.
4. **Append-only progress logs.** Never overwrite or truncate `features/{id}-{slug}/progress.txt`. Use `>>`, not `>`.
5. **Story ownership.** Only the agent assigned to a feature modifies that feature's `stories.json`. If the assigned agent does not match your slug, halt and report.
6. **No cross-repo mutations without coordination.** If a story requires changes in two repos, complete and push one before starting the second. Never hold uncommitted changes across two repos simultaneously.
7. **Merge window.** When two agents have PRs open for the same repo, the first to merge wins; the second must rebase before merging. The operator coordinates merge order if there are conflicts. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — items 1-7 are multi-agent coordination conventions (branch/folder/story ownership, staleness checks, append-only logs, cross-repo sequencing, merge order) with no code in this repo that checks another agent honored them.**
8. **Working-tree vantage point (EF-33 / [ARC-028](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-028--concurrency-and-isolation-model-for-parallel-work) R7) — applies even to a solo agent, not only when multiple agents are active.** Listed here because it's the working-tree/multi-primitive dimension [ARC-028](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-028--concurrency-and-isolation-model-for-parallel-work) R7 defines, not because the hazard requires a second agent: a lone agent working through a bridged/remote mount hits the identical near-miss. All linked worktrees share one physical `.git` and `.git/config` — treat config-mutating operations as fleet-wide, not scoped to the worktree that ran them. Before any `git worktree prune`, `worktree remove`, `gc`, or branch deletion, confirm the target path from the *current process's own filesystem* (not just Git's own report) — a repository or its linked worktrees reached through a bridged/remote mount can report a live, healthy worktree as safe to prune with no error distinguishing "confirmed absent" from "not resolvable from here." See [governance/git-conventions.md](/docs/reference/git-conventions) Same-Vantage-Point Check section for the full procedure, including how to establish that your own vantage point is trustworthy before relying on it. **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-commit-work` Step 10 and `spell-close-session`'s worktree-deletion step both require running this check before a worktree-adjacent branch/worktree deletion; the vantage-point determination itself stays a manual judgment call, which `git-conventions.md`'s own Same-Vantage-Point Check section calls "a standing operational caution, not a code-level gate."**

---

## Planning Artifact Routing Policy

When producing planning artifacts (PRD, architecture, stories.json, UX specs), agents **must** write outputs to the correct location for their lifecycle stage:

| Stage                   | Artifact destination                                | Example path                              |
| ----------------------- | --------------------------------------------------- | ----------------------------------------- |
| **Concept / Prototype** | A governed ventures/prototype directory             | `ventures/widget-app/PRD.md`              |
| **Feature**             | `features/{id}-{slug}/` in the **target code repo** | `features/42-calibration/architecture.md` |

**Never** write planning artifacts to:

- The agent's own workspace root.
- The root of a code repo (e.g. alongside `src/`).
- Temporary or unversioned locations.

Planning artifacts are the reproducible source of truth — code can be regenerated from them. They must live in a git-tracked, governed location. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — no check in this repo verifies where a PRD, architecture doc, or `stories.json` was actually written.**

---

## Repo Routing Rules

Agents must place artifacts in the correct repository. Misrouting (e.g. code in a docs repo) wastes operator time and pollutes workspaces.

| Artifact Type                    | Target Repository                                          | Examples                                        |
| -------------------------------- | --------------------------------------------------------- | ----------------------------------------------- |
| Application code, POCs, features | The appropriate code repo                                 | API endpoints, UI components, tests, migrations |
| Documentation, governance, ADRs  | The docs/governance repo                                  | Policies, playbooks, journal entries, decisions |
| Infrastructure-as-code           | The infra directory or a dedicated infra repo             | Terraform modules, scripts                      |
| Feature planning artifacts       | The repo where the code will live, under `features/{id}-{slug}/` | PRD.md, architecture.md, stories.json     |

**Rules:**

1. **Code never goes in the docs repo** unless it is infrastructure-as-code or the feature is explicitly scoped to the docs repo.
2. **If no existing code repo fits**, the agent must ask the operator to identify or create the target repo. Repo creation is always Spectator-level (human-only).
3. **Delegation must include the target repo.** When an orchestrator delegates work, the delegation message must specify which repo the work targets. If ambiguous, ask the operator before delegating.
4. **POC code** without a permanent home should go in an operator-designated repo or a new repo — never in the docs repo by default.

**Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — these routing rules depend on the acting agent's own judgment about repo fit; nothing in this repo checks that an artifact landed in the repo this section prescribes.**

---

## PR Notification & Hygiene

Agents creating pull requests must ensure the operator is aware and that PRs do not accumulate unreviewed.

### PR Creation Requirements

1. **Work item linking is encouraged** for traceability; for small ops/doc PRs it may be omitted.
2. **PR title** follows Conventional Commits format: `type(scope): description`.
3. **PR description** must include: summary of changes, rationale, verification steps, and any linked work item ID.

**Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-create-pull-request` generates a title and description in this shape by default, but nothing rejects a PR opened without one.**

### PR Notification

When an agent creates or updates a PR, notify the operator (routed through the orchestrator) with: repo name, PR link, work item ID (if any), and a one-line summary. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — no check confirms the operator was actually notified.**

### PR Hygiene Cadence

- **At the start of every session:** list all open PRs across repos; flag PRs older than 3 days as stale. **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — `spell-open-session`'s "Open PRs" step lists open PRs and flags them stale/overdue at these exact thresholds, though only when tracking mode is external/ADO and ADO MCP is available — it is not universal across every provider/session.**
- **7-day threshold:** PRs open longer than 7 days without activity are flagged for closure. The operator decides whether to merge, update, or abandon. **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — the same `spell-open-session` step above flags PRs older than 7 days as overdue in the same pass.**
- **After merge:** the merging actor (agent or human) deletes the source branch (local and remote). **Enforcement: structured spell gate ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — the same `spell-commit-work` Step 10 / `spell-close-session` branch-deletion mechanism cited under Branch Discipline.**

---

## Hardening Baseline (Policy)

This section defines the minimum hardening policy baseline for production operations. It is normative for runbooks and future automation. **Enforcement: explicitly advisory prose ([ARC-023](https://github.com/codemagicianhq/arcane/blob/v1.24.1/DECISIONS.md#arc-023--normative-controls-require-inline-enforcement-contracts)) — every deny/allow list and hardening principle below describes deployment/runtime configuration for wherever an agent actually executes; this repository's own CLI code does not run agents or observe their runtime privileges, network exposure, or filesystem access, so none of it is independently checked here.**

### Execution Restriction Baseline

Agents must not execute command classes that can escalate privileges, alter host security posture, or exfiltrate credentials.

**Deny classes:**

- Privilege escalation commands (e.g. `sudo`, `su`, root shell pivots).
- Direct host package-manager mutation without explicit approval.
- Kernel/network control-plane changes (firewall, sysctl, host service management).
- Credential/file scraping patterns targeting SSH keys, browser stores, password vaults, or shell history.
- Destructive filesystem operations outside approved workspace roots.

**Allow by default:**

- Read operations and non-destructive edits inside approved workspace roots.
- Project-local tooling needed for business workflows under approved directories.

### Filesystem Scope Baseline

- Each agent has a default writable workspace root.
- Additional writable roots require explicit per-deployment approval and must be documented in agent config.
- Paths outside approved roots are read-deny and write-deny by policy.
- Cross-business writes are denied unless a shared integration directory is explicitly approved.

### Generic Runtime Hardening Principles

Regardless of the specific runtime, apply these timeless controls:

- **Run the agent as a non-root user.** Never grant the runtime root privileges.
- **Limit network exposure.** Bind gateways to loopback or a private network; do not expose them publicly. Authenticate any remote access with a token sourced from a secret reference, never a literal.
- **Scope filesystem access.** Restrict the runtime to its workspace and config directories; lock down config-file permissions so only the owning user can read them.
- **Enforce strict channel policies in production.** Replace permissive test values (open DM policy, wildcard allowlists) with pairing/allowlist policies before going live.
- **Deny self-modification.** Prevent agents from editing their own runtime configuration.
- **Keep secrets out of the command line.** Use secret references (environment variables) and interactive prompts that do not echo.

---

_Expand with specific allow/deny lists as agents are created for each deployment._
