Skip to content

This section explains how M31A works, rather than how to operate it. The user-facing guides cover commands and settings; these pages follow the data through the runtime and name the source files that implement each stage.

Start with the agent loop: it is the spine that connects prompt assembly, the NIM request, streamed events, tool execution, and session persistence.

Concept map ​

ConceptQuestion it answersMain implementation
Agent loopHow does a prompt become a response, and then another request?packages/core/src/core/m31aChat.ts, packages/core/src/core/turn.ts
Context lifecycleWhat context is loaded, compacted, distilled, masked, or narrated?packages/core/src/context/, packages/core/src/utils/memoryDiscovery.ts
Tool executionHow is a tool call discovered, authorized, run, and reported back?packages/core/src/scheduler/, packages/core/src/tools/
Policy evaluationWhich rule wins when trust, modes, allowlists, and admin rules disagree?packages/core/src/policy/
Session storageWhere are conversations and checkpoints written, and how are they found?packages/core/src/services/chatRecordingService.ts, packages/core/src/services/sessionSearchIndex.ts
Extension modelWhat is the difference between an extension, a skill, an MCP server, a hook, and a command?packages/cli/src/config/extension-manager.ts, packages/core/src/utils/extensionLoader.ts
Model resolutionHow does an alias become a concrete NIM model ID, with what config and fallback?packages/core/src/services/modelConfigService.ts

How the concepts fit together ​

text
user prompt
   |
   v
[Context lifecycle] ---- M31A.md, include dirs, compression, masking
   |
   v
[Agent loop] ---- [Model resolution] ---- NVIDIA NIM /chat/completions
   |                                          |
   |                                          v
   |                              streamed text / tool calls
   v
[Tool execution] ---- [Policy evaluation] ---- trust, modes, rules, admin
   |
   v
[Session storage] ---- JSONL records, checkpoints, FTS index

Extensions cut across every layer: they contribute skills, tools, hooks, policies, commands, themes, and context files. They are loaded before the agent loop starts so that the loop sees a fully assembled tool registry and policy engine.

Read in this order ​

  1. Agent loop — the end-to-end request cycle.
  2. Context lifecycle — what goes into the prompt.
  3. Tool execution and Policy evaluation — how calls are authorized.
  4. Session storage — what survives after the run.
  5. Extension model and Model resolution — how the runtime is customized.

When you need the guides instead ​

Hands-on practice ​

The Tutorials index turns these concepts into exercises: reviewing a diff, building an MCP server, authoring a skill or hook, packaging an extension, running CI, using worktrees, adding a provider, and hardening a sandbox.

Next steps ​

  • Follow the agent loop from prompt to persistence.
  • Then choose a tutorial to apply the concepts.

Built with VitePress. Powered by NVIDIA NIM.