Skip to main content

M31A Codebase Reference

Authoritative Implementation Index: 567 first-party Rust source files across 42 functional subsystems.

This section provides an exhaustive, verified reference for the entire M31A application codebase located at /home/snigdha/Desktop/M31A/src/. Every module, struct, enum, trait, and function documented here corresponds to tested code in revision 3eddbfd3.

Subsystem Navigation Matrix​

SubsystemLayerFilesDescriptionReference Link
Agent SubsystemL4 Agents17Agent roles, lifecycle, supervisor, runner, adaptive replanning, and delegationInspect Modules
Capability Registry & ProvidersL2 Capabilities38Typed capabilities, health monitoring, provider implementations (fs, git, lsp, terminal, web, etc.)Inspect Modules
Change ManagementL6 Execution7Workspace change application, review, provenance, authority, and reconciliationInspect Modules
Checkpoint & Crash RecoveryL6/L7 Checkpoints6Two-phase durable checkpoint protocol, manifest hashing, crash recovery scanner, and safe resumeInspect Modules
CLI & Dispatch LayerL9 CLI / Interface6Clap 4 argument hierarchy, output formatters, exit codes, and runtime command dispatchInspect Modules
Configuration EngineL1 Configuration118-tier hierarchical configuration precedence, strict schema validation, canonical defaults, and provenanceInspect Modules
Context Compiler & TokenizerL3 Intelligence8Token budgeting, prompt envelope assembly, evidence ranking, and context window compactionInspect Modules
Autonomy ControllerL8 Autonomy8Execution stage transitions, halting criteria, loop detection, and progress monitoringInspect Modules
DAG & Critical Path MethodL5 Planning7Directed acyclic task graphs, topological sorting, critical path analysis, and reconciliationInspect Modules
Deployment & ChannelsL9 Deployment11Compile-time channel isolation (production vs development), update feeds, installer, and rollbackInspect Modules
Autonomous Evaluation HarnessL7 Verification13Acceptance test scenarios A through H, scoring, and automated evaluation runnerInspect Modules
Event Bus & EnvelopesL0/L8 Event Bus4Broadcast channels, structured telemetry envelopes, and asynchronous event distributionInspect Modules
Git & Worktree IsolationL2 Git Operations10Worktree management, branch naming, isolated attribution, trailers, stash, and hostingInspect Modules
Domain Identity TypesL0 Domain Identities18Strongly typed domain IDs (ExecutionRunId, TaskId, AgentId, ArtifactId, CheckId, etc.)Inspect Modules
Initialization & DoctorL9 Initialization4Workspace setup wizard, environment diagnostic probes, and lifecycle bootstrappingInspect Modules
Interaction & Slash CommandsL9 Interaction13Session parser, user-defined slash commands, approval actions, and mention resolutionInspect Modules
Kernel Core & SeamsL0 Kernel16Core seams, architectural invariants, cancellation tokens, hashes, and memory boundariesInspect Modules
Engineering MemoryL3 Intelligence6Persistent engineering decisions, architectural assumptions, and historical project memoryInspect Modules
Model & Provider LayerL3 Intelligence16NVIDIA NIM provider, SSE streaming, model catalog, dynamic discovery, and token usageInspect Modules
Persistence & SQLiteL0 Persistence26SQLite database pool, schema migrations 001-032, repositories, and artifact storeInspect Modules
Pipeline ExecutionL5/L6 Pipeline18End-to-end task pipelines, staging, execution harnesses, and lifecycle transitionsInspect Modules
Planning & DecompositionL5 Planning15Mission decomposition, strategy generation, plan revision, and candidate DAG creationInspect Modules
Platform AbstractionsL1 Platform17Cross-platform OS primitives (Linux, macOS, Windows), process control, and path handlingInspect Modules
Policy Engine & Security GatesL1 Security15Non-bypassable policy evaluation, 4 decisions (Allow/Deny/Ask/Escalate), and approvalsInspect Modules
Process SupervisionL2 Process11Process tree supervisor, PID tracking, spool capture, signal escalation, and timeoutsInspect Modules
Prompt SystemL3 Intelligence16Prompt registry, template rendering, versioning, and prompt referencesInspect Modules
Recovery & ReplanningL7 Recovery5Differential replanning, failure diagnosis, and automated remediationInspect Modules
Release CertificationL9 Release8Release manifests, 20-point production evidence matrix, and release certificationInspect Modules
Repository IntelligenceL2 Repository13Code search, symbol extraction, dependency graph, and workspace drift detectionInspect Modules
Execution ReportsL8 Reporting6Structured scorecard generation, telemetry summaries, and execution reportsInspect Modules
Root Application & RuntimeL0-L9 Composition6main.rs, lib.rs, error taxonomy, and authoritative AppRuntime composition rootInspect Modules
Sandbox & ConfinementL1 Sandbox13Filesystem sandboxing, network destination policies, and resource confinementInspect Modules
Scheduler & Job AdmissionL5 Scheduling10Global job worker pool, concurrency limits, and task schedulingInspect Modules
Skill SystemL2 Skills6Modular skill discovery, invocation, and in-task execution guidanceInspect Modules
Authoritative State ManagementL8 State15Execution run state, session state, task state, and SQLite projectionInspect Modules
Domain State MachinesL8 State Machine9Strict state transition matrices for missions, tasks, agents, and autonomy modesInspect Modules
Storage LayoutL0 Storage2Platform storage layout, global vs workspace state isolation, and legacy migrationsInspect Modules
Telemetry & SpansL8 Telemetry7Distributed tracing spans, metrics recording, and operational observabilityInspect Modules
Model Tools & CatalogL2 Tools18Central catalog of 28 core tools and extended tools (fs, git, qa, repo, web, etc.)Inspect Modules
Ratatui TUI CockpitL9 TUI Cockpit6262-file terminal cockpit, read-only projection over SQLite, streaming, and screensInspect Modules
Verification & Nyquist GateL7 Verification157-tier verification hierarchy, evidence snapshot matching, and completion gateInspect Modules
Genesis & Engineering WorkflowsL8 Workflow3535-file multi-stage genesis workflows, ADR creation, charter, synthesis, and roadmapInspect Modules

Total Source Footprint: 567 Rust source files, approximately 230,961 lines of code.

Architectural Layers Summary​

Architectural Law: Downward Dependency Discipline​

Dependencies flow downward only. A lower layer (e.g., L1 Security) may never import or depend on a higher layer (e.g., L8 Autonomy or L9 CLI). All model proposals pass downward through L5 (DAG), L1 (Policy Gate), before reaching L2 (Side-effect tools) or L0 (Persistence).