Design Spec: /atlas-audit

Date: 2026-04-15

Status: Draft

Owner: Atlas


Purpose

A single comprehensive skill that audits, measures, restructures, and monitors fleet operational efficiency. This is Atlas's prime directive skill — "how efficient are our fleet ops" expressed as a runnable tool.

The skill produces metrics (writes to SSOT tables), makes structural improvements (rewrites CLAUDE.md, compresses rules, deduplicates memory), and establishes baselines for ongoing monitoring. It replaces /context-diet, /reconcile, and /manifest refresh as the one maintenance skill.


Prerequisites

1. SSOT Guide (docs/ssot/GUIDE.md)

Must exist before the skill can make decisions. Defines:

2. Metrics Tables (Pantheon Supabase)

The skill writes measurements to these tables. Designed by Proteus, owned by Atlas.

fleet_context_metrics

Per-repo context efficiency measurements.

ColumnTypeDescription
iduuidPK
repotextFK to fleet_repositories.name
measured_attimestamptzWhen this measurement was taken
measured_bytextSession/agent that took the measurement
claude_md_charsintCLAUDE.md character count
repo_rules_charsint.claude/rules/ total chars
global_rules_charsint~/.claude/rules/ total chars
memory_index_charsintMEMORY.md index chars
memory_files_charsintTotal memory topic file chars
memory_file_countintNumber of memory topic files
skills_countintNumber of skills in .claude/skills/
skills_frontmatter_charsintTotal skill frontmatter chars (system prompt cost)
agents_countintNumber of agent definitions
agents_charsintTotal agent definition chars
always_loaded_totalintSum of all always-loaded content chars
est_tokensintalways_loaded_total / 4 (rough estimate)
context_files_charsintOn-demand context/ directory total chars
audit_typetext'full' or 'monitor'

fleet_ssot_compliance

Per-repo SSOT alignment scores.

ColumnTypeDescription
iduuidPK
repotextFK to fleet_repositories.name
measured_attimestamptz
hardcoded_factsintFacts found in markdown that should be in fleet tables
ssot_referencesintLines that correctly reference SSOT (fleet CLI, queries)
duplicate_rulesintRules loaded multiple times (global + repo + memory overlap)
stale_memory_filesintMemory files whose content is now in code/git/tables
unverified_factsintFacts in fleet tables with unverified trust level
compliance_scorenumeric0-100, weighted composite

fleet_tool_efficiency

Session-level tool usage patterns (populated by Argus or session-end hooks).

ColumnTypeDescription
iduuidPK
repotext
session_idtext
measured_attimestamptz
cli_lookupsintfleet/fleet-path calls via Bash
mcp_lookupsintMCP tool calls for SSOT data
toolsearch_callsintToolSearch invocations (overhead indicator)
total_tool_callsintAll tool calls in session
transcript_charsintTotal session transcript size
cli_first_rationumericcli_lookups / (cli_lookups + mcp_lookups)

Operational Model

Full Audit

Run once per repo. Heavy. Produces baseline, makes structural changes.


/atlas-audit <repo-path>
/atlas-audit ~/Dev/_K4120S/constellation-hades

Monitor Check

Lightweight. Measures current state, compares to baseline, flags drift.


/atlas-audit monitor <repo-path>
/atlas-audit monitor --fleet       # all repos

Re-audit Trigger

When a repo's metrics fall behind the fleet average (detected by Argus or the monitor check), a full audit is triggered. The operator decides — Atlas does not auto-audit.


Full Audit Protocol

Phase 1: Measure (read-only)

Baseline everything. Write measurements to fleet_context_metrics.

  1. Always-loaded content: CLAUDE.md + repo rules + global rules + MEMORY.md + memory topic files
  2. On-demand content: context/ directory, skills (frontmatter only), agent definitions
  3. SSOT compliance scan:
  1. Fact/statement classification: For each finding, classify using s6#8 — is this a fact (would cause wrong agent behavior if wrong) or a statement (context/rationale)?

Output: Baseline report with current numbers.

Phase 2: Plan (operator review)

Present findings organized by impact. No changes yet.

For each finding:


FINDING: {description}
Type: fact | statement | duplicate | stale
Location: {file}:{line range}
Impact: {chars saved if fixed}
Action: {move to fleet table | move to Aion | delete | compress | reference SSOT}

Group by action type. Show total projected savings.

The operator approves, modifies, or rejects the plan.

Phase 3: Execute (structural changes)

Apply approved changes:

  1. Facts in markdown → Verify the fact exists in a fleet table. If it does, replace the markdown with a fleet CLI reference. If it doesn't, INSERT the fact (unverified) and replace the markdown.
  2. Statements in CLAUDE.md → Move to Aion wiki via aion_capture or to context/ as a deferrable reference file.
  3. Duplicate rules → Remove the duplicate, keep the highest-authority source (fleet_rules > global rules > repo rules > memory).
  4. Stale memory → Archive (never delete without operator confirmation).
  5. Bloated sections → Compress. Verbose violation rules become table rows. Repo maps stay (structural, needed for navigation).
  6. Missing SSOT references → Add fleet CLI commands where agents need to look up facts.

Phase 4: Verify

Re-measure everything. Write post-audit measurements to fleet_context_metrics with audit_type = 'full'. Compute delta:


## Audit Complete

Before: {N} chars ({T} est. tokens) always-loaded
After:  {N2} chars ({T2} est. tokens) always-loaded
Saved:  {delta} chars ({pct}% reduction)

SSOT compliance: {before_score} → {after_score}
Hardcoded facts: {before} → {after}
Duplicate rules: {before} → {after}

Write compliance score to fleet_ssot_compliance.


Monitor Protocol

Lightweight check. No structural changes. Runs in < 30 seconds.

  1. Measure always-loaded chars for target repo(s)
  2. Compare to most recent fleet_context_metrics row for that repo
  3. If delta > 10% growth since last audit: flag for re-audit
  4. If any new hardcoded facts detected: flag
  5. Write monitor measurement to fleet_context_metrics with audit_type = 'monitor'

For fleet-wide monitor:


Atlas KPIs (displayed on Atlas UI page)

These are the metrics the Atlas page in the Pantheon web app will show:

Context Efficiency

SSOT Compliance

Tool Call Efficiency

Session Cost

Skill & Rule Health


Integration Points

SystemHow atlas-audit connects
ArgusMonitor check can be added as an Argus probe (P-level). Argus flags repos that drift.
fleet_rulesAudit reads rules to understand what should be in tables vs markdown. Writes new facts found during audit.
AionStatements found in markdown are captured to Aion wiki. Decision rationale from the audit itself is captured.
ArsenalAudit checks skill symlink health. Reports broken or missing distributions.
Atlas UIUI reads fleet_context_metrics, fleet_ssot_compliance, fleet_tool_efficiency tables.
fleet CLIAudit uses fleet commands for all SSOT lookups (CLI-first).
/startSession start can include a quick monitor check if the repo hasn't been measured in N days.

What This Replaces

Old SkillWhat atlas-audit absorbs
/context-dietPhase 3 pruning (but SSOT-aware, not just size-based)
/reconcilePhase 1 SSOT compliance scan (but with metrics, not just drift detection)
/manifest refreshPhase 1 structural measurement (but writes to fleet tables, not markdown)
/domain-architectPhase 3 restructuring (but driven by measurements, not ad-hoc)

The old skills can remain as lightweight aliases or be deprecated. atlas-audit is the comprehensive version.


Design Decisions

DecisionChoiceRationale
OwnershipAtlas onlyOne authoritative voice prevents conflicting self-optimization across agents
CLI-first for all SSOT accessfleet CLI, not MCP~7x more token-efficient, 1 tool call vs 2+, compact output
Fact/statement classificationfleet_rules s6#8Operator-defined: "if wrong value causes wrong agent behavior, it's a fact"
Metrics in Supabase tablesfleet_context_metrics, fleet_ssot_compliance, fleet_tool_efficiencySSOT principle: metrics are facts about the fleet, they go in tables
Operator approval before changesPhase 2 plan reviewStructural changes to agent harnesses are high-impact, not automated
Monitor as separate modeLightweight, no changesFull audit is expensive; monitoring should be cheap enough for Argus
Archive, never deleteMemory and stale content moves to archive dirsReversibility; operator can review archived content

Open Questions

  1. Argus probe integration: Should the monitor check become an official Argus probe (e.g., P24)? This would make it automated on the 6-hour Argus cycle.
  1. Session cost metering: stats-cache.json is 33 days stale. No API token metering exists. The tool efficiency table can only be populated if we build a metering layer or scrape the Anthropic Console. What's the path here?
  1. fleet_tool_efficiency population: This table requires parsing session transcripts for tool call patterns. Should this be a session-end hook, an Argus probe, or part of the JSONL parsing pipeline that Mnemosyne is designing?
  1. Old skill deprecation: Should /context-diet, /reconcile, /manifest refresh be removed from Arsenal distribution, or kept as lightweight shortcuts that call into atlas-audit phases?
  1. Cross-repo execution: atlas-audit targets other repos. Should it read their files directly (simple, but crosses domain boundaries), or dispatch measurements to the owning agent and collect results?