# silent14725/ablagent architecture

> Architecture diagram of the GitHub repository silent14725/ablagent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/silent14725/ablagent
- Repository: https://github.com/silent14725/ablagent

## Overview

Ablagent is an evidence-first Domain Weight Modification research runtime. Its principal real-checkpoint workflow pins a dense HuggingFace checkpoint, captures baseline and direction evidence, applies a selected edit, and records an experimental export; the mock pipeline and control plane support inspectable stage state and gated records. The README also describes architecture contracts, artifact replay, and a broader format-research recipe library. The real pipeline excerpt shows initialization and baseline work, while the source index supports several module relationships; unsampled wiring is omitted rather than inferred.

Main entry points: [`src/ablagent/pipeline_real.py`](https://github.com/silent14725/ablagent/blob/main/src/ablagent/pipeline_real.py) (Real pipeline), [`src/ablagent/artifacts.py`](https://github.com/silent14725/ablagent/blob/main/src/ablagent/artifacts.py) (Artifact store), [`src/ablagent/adapters/hf_capture.py`](https://github.com/silent14725/ablagent/blob/main/src/ablagent/adapters/hf_capture.py) (Baseline and capture), [`src/ablagent/control/store.py`](https://github.com/silent14725/ablagent/blob/main/src/ablagent/control/store.py) (Control state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Runtime orchestration"]
  node_cli["Command interface<br/>[cli.py]"]
  node_real_pipeline["Real pipeline<br/>[pipeline_real.py]"]
  node_mock_pipeline["Mock pipeline<br/>[pipeline.py]"]
  node_run_record["Run records<br/>[run.py]"]
  node_packs["Domain packs<br/>[packs.py]"]
end

subgraph group_checkpoint["Checkpoint adapters"]
  node_hf_intake["Checkpoint intake<br/>[hf_intake.py]"]
  node_hf_capture["Baseline and capture<br/>[hf_capture.py]"]
  node_hf_bake["HF weight bake<br/>[hf_bake.py]"]
end

subgraph group_dwm["DWM artifacts"]
  node_contracts["DWMIP contracts<br/>[contracts.py]"]
  node_identity["Graph and writer identity<br/>[identity.py]"]
  node_interventions["Interventions<br/>[interventions.py]"]
  node_artifact_store[("Artifact store<br/>[artifacts.py]")]
  node_canonical["Canonical encoding<br/>[canonical.py]"]
end

subgraph group_control["Evidence and control"]
  node_evidence["Evidence records<br/>[evidence.py]"]
  node_control_store[("Control state<br/>[store.py]")]
  node_control_codec["Control codec<br/>[codec.py]"]
  node_control_files["Private file operations<br/>[files.py]"]
  node_redline["Release red-line gate<br/>[redline.py]"]
end

subgraph group_research["Research recipes"]
  node_recipe_runner["Qwen recipe runner<br/>[run_dwm.py]"]
  node_recipe_core["Qwen DWM core<br/>[dwm_core.py]"]
end

node_researcher(("Researcher"))

node_researcher -->|"invokes"| node_cli
node_cli -.->|"runs"| node_real_pipeline
node_real_pipeline -->|"pins checkpoint"| node_hf_intake
node_real_pipeline -->|"captures baseline"| node_hf_capture
node_real_pipeline -->|"applies edit"| node_hf_bake
node_real_pipeline -->|"stores artifacts"| node_artifact_store
node_real_pipeline -->|"records stages"| node_control_store
node_real_pipeline -->|"loads configuration"| node_packs
node_real_pipeline -->|"creates run"| node_run_record
node_mock_pipeline -->|"records stages"| node_control_store
node_mock_pipeline -->|"loads configuration"| node_packs
node_hf_intake -->|"declares surface"| node_identity
node_hf_intake -->|"writes snapshot"| node_artifact_store
node_hf_capture -->|"resolves writers"| node_identity
node_hf_capture -->|"emits directions"| node_interventions
node_hf_capture -->|"writes capture"| node_artifact_store
node_hf_bake -->|"compiles edit"| node_interventions
node_hf_bake -->|"writes edited artifact"| node_artifact_store
node_artifact_store -->|"encodes metadata"| node_canonical
node_artifact_store -->|"validates graph"| node_identity
node_artifact_store -->|"stores intervention"| node_interventions
node_identity -->|"computes digests"| node_canonical
node_control_store -->|"encodes state"| node_control_codec
node_control_store -->|"reads and writes"| node_control_files
node_recipe_runner -->|"calls"| node_recipe_core
node_mock_pipeline -->|"evaluates gate"| node_redline

click node_cli "https://github.com/silent14725/ablagent/blob/main/src/ablagent/cli.py"
click node_real_pipeline "https://github.com/silent14725/ablagent/blob/main/src/ablagent/pipeline_real.py"
click node_mock_pipeline "https://github.com/silent14725/ablagent/blob/main/src/ablagent/pipeline.py"
click node_run_record "https://github.com/silent14725/ablagent/blob/main/src/ablagent/run.py"
click node_packs "https://github.com/silent14725/ablagent/blob/main/src/ablagent/packs.py"
click node_hf_intake "https://github.com/silent14725/ablagent/blob/main/src/ablagent/adapters/hf_intake.py"
click node_hf_capture "https://github.com/silent14725/ablagent/blob/main/src/ablagent/adapters/hf_capture.py"
click node_hf_bake "https://github.com/silent14725/ablagent/blob/main/src/ablagent/adapters/hf_bake.py"
click node_contracts "https://github.com/silent14725/ablagent/blob/main/src/ablagent/contracts.py"
click node_identity "https://github.com/silent14725/ablagent/blob/main/src/ablagent/identity.py"
click node_interventions "https://github.com/silent14725/ablagent/blob/main/src/ablagent/interventions.py"
click node_artifact_store "https://github.com/silent14725/ablagent/blob/main/src/ablagent/artifacts.py"
click node_canonical "https://github.com/silent14725/ablagent/blob/main/src/ablagent/canonical.py"
click node_evidence "https://github.com/silent14725/ablagent/blob/main/src/ablagent/evidence.py"
click node_control_store "https://github.com/silent14725/ablagent/blob/main/src/ablagent/control/store.py"
click node_control_codec "https://github.com/silent14725/ablagent/blob/main/src/ablagent/control/codec.py"
click node_control_files "https://github.com/silent14725/ablagent/blob/main/src/ablagent/control/files.py"
click node_redline "https://github.com/silent14725/ablagent/blob/main/src/ablagent/security/redline.py"
click node_recipe_runner "https://github.com/silent14725/ablagent/blob/main/recipes/qwen-9b-class/run_dwm.py"
click node_recipe_core "https://github.com/silent14725/ablagent/blob/main/recipes/qwen-9b-class/lib/dwm_core.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_real_pipeline,node_mock_pipeline,node_run_record,node_packs toneBlue
class node_hf_intake,node_hf_capture,node_hf_bake toneAmber
class node_contracts,node_identity,node_interventions,node_artifact_store,node_canonical toneMint
class node_evidence,node_control_store,node_control_codec,node_control_files,node_redline toneRose
class node_recipe_runner,node_recipe_core,node_researcher toneIndigo
```

## Components

### Runtime orchestration

- [Command interface](https://github.com/silent14725/ablagent/blob/main/src/ablagent/cli.py): `src/ablagent/cli.py`
- [Real pipeline](https://github.com/silent14725/ablagent/blob/main/src/ablagent/pipeline_real.py): `src/ablagent/pipeline_real.py`
- [Mock pipeline](https://github.com/silent14725/ablagent/blob/main/src/ablagent/pipeline.py): `src/ablagent/pipeline.py`
- [Run records](https://github.com/silent14725/ablagent/blob/main/src/ablagent/run.py): `src/ablagent/run.py`
- [Domain packs](https://github.com/silent14725/ablagent/blob/main/src/ablagent/packs.py): `src/ablagent/packs.py`

### Checkpoint adapters

- [Checkpoint intake](https://github.com/silent14725/ablagent/blob/main/src/ablagent/adapters/hf_intake.py): `src/ablagent/adapters/hf_intake.py`
- [Baseline and capture](https://github.com/silent14725/ablagent/blob/main/src/ablagent/adapters/hf_capture.py): `src/ablagent/adapters/hf_capture.py`
- [HF weight bake](https://github.com/silent14725/ablagent/blob/main/src/ablagent/adapters/hf_bake.py): `src/ablagent/adapters/hf_bake.py`

### DWM artifacts

- [DWMIP contracts](https://github.com/silent14725/ablagent/blob/main/src/ablagent/contracts.py): `src/ablagent/contracts.py`
- [Graph and writer identity](https://github.com/silent14725/ablagent/blob/main/src/ablagent/identity.py): `src/ablagent/identity.py`
- [Interventions](https://github.com/silent14725/ablagent/blob/main/src/ablagent/interventions.py): `src/ablagent/interventions.py`
- [Artifact store](https://github.com/silent14725/ablagent/blob/main/src/ablagent/artifacts.py): `src/ablagent/artifacts.py`
- [Canonical encoding](https://github.com/silent14725/ablagent/blob/main/src/ablagent/canonical.py): `src/ablagent/canonical.py`

### Evidence and control

- [Evidence records](https://github.com/silent14725/ablagent/blob/main/src/ablagent/evidence.py): `src/ablagent/evidence.py`
- [Control state](https://github.com/silent14725/ablagent/blob/main/src/ablagent/control/store.py): `src/ablagent/control/store.py`
- [Control codec](https://github.com/silent14725/ablagent/blob/main/src/ablagent/control/codec.py): `src/ablagent/control/codec.py`
- [Private file operations](https://github.com/silent14725/ablagent/blob/main/src/ablagent/control/files.py): `src/ablagent/control/files.py`
- [Release red-line gate](https://github.com/silent14725/ablagent/blob/main/src/ablagent/security/redline.py): `src/ablagent/security/redline.py`

### Research recipes

- [Qwen recipe runner](https://github.com/silent14725/ablagent/blob/main/recipes/qwen-9b-class/run_dwm.py): `recipes/qwen-9b-class/run_dwm.py`
- [Qwen DWM core](https://github.com/silent14725/ablagent/blob/main/recipes/qwen-9b-class/lib/dwm_core.py): `recipes/qwen-9b-class/lib/dwm_core.py`

### Other components

- **Researcher**

## Connections

- Researcher → Command interface: invokes
- Command interface → Real pipeline: runs
- Real pipeline → Checkpoint intake: pins checkpoint (evidence: `src/ablagent/pipeline_real.py`)
- Real pipeline → Baseline and capture: captures baseline (evidence: `src/ablagent/pipeline_real.py`)
- Real pipeline → HF weight bake: applies edit (evidence: `src/ablagent/pipeline_real.py`)
- Real pipeline → Artifact store: stores artifacts (evidence: `src/ablagent/pipeline_real.py`)
- Real pipeline → Control state: records stages (evidence: `src/ablagent/pipeline_real.py`)
- Real pipeline → Domain packs: loads configuration (evidence: `src/ablagent/pipeline_real.py`)
- Real pipeline → Run records: creates run (evidence: `src/ablagent/pipeline_real.py`)
- Mock pipeline → Control state: records stages (evidence: `src/ablagent/pipeline.py`)
- Mock pipeline → Domain packs: loads configuration (evidence: `src/ablagent/pipeline.py`)
- Checkpoint intake → Graph and writer identity: declares surface (evidence: `src/ablagent/adapters/hf_intake.py`)
- Checkpoint intake → Artifact store: writes snapshot (evidence: `src/ablagent/adapters/hf_intake.py`)
- Baseline and capture → Graph and writer identity: resolves writers (evidence: `src/ablagent/adapters/hf_capture.py`)
- Baseline and capture → Interventions: emits directions (evidence: `src/ablagent/adapters/hf_capture.py`)
- Baseline and capture → Artifact store: writes capture (evidence: `src/ablagent/adapters/hf_capture.py`)
- HF weight bake → Interventions: compiles edit (evidence: `src/ablagent/adapters/hf_bake.py`)
- HF weight bake → Artifact store: writes edited artifact (evidence: `src/ablagent/adapters/hf_bake.py`)
- Artifact store → Canonical encoding: encodes metadata (evidence: `src/ablagent/artifacts.py`)
- Artifact store → Graph and writer identity: validates graph (evidence: `src/ablagent/artifacts.py`)
- Artifact store → Interventions: stores intervention (evidence: `src/ablagent/artifacts.py`)
- Graph and writer identity → Canonical encoding: computes digests (evidence: `src/ablagent/identity.py`)
- Control state → Control codec: encodes state (evidence: `src/ablagent/control/store.py`)
- Control state → Private file operations: reads and writes (evidence: `src/ablagent/control/store.py`)
- Qwen recipe runner → Qwen DWM core: calls (evidence: `recipes/qwen-9b-class/run_dwm.py`)
- Mock pipeline → Release red-line gate: evaluates gate (evidence: `src/ablagent/pipeline.py`)
