# camdenleibee/final-project architecture

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

- Interactive diagram: https://gitdiagram.com/camdenleibee/final-project
- Repository: https://github.com/camdenleibee/final-project

## Overview

MiniHarness is a scripted/replay assistant harness with optional tool use, persistent memory, skill loading, context budgeting, and command policy. The principal flow is terminal input through the harness/model turn loop; model tool calls are dispatched to tools, whose results re-enter the conversation before the next model call. The graph also preserves the documented memory, skills, context-selection, and command-audit branches. Some implementation files were not excerpted, so their internal call edges are omitted unless documented or named by the source index.

Main entry points: [`src/main.cpp`](https://github.com/camdenleibee/final-project/blob/main/src/main.cpp) (CLI Composition), [`src/harness/harness.cpp`](https://github.com/camdenleibee/final-project/blob/main/src/harness/harness.cpp) (Turn Harness), [`src/harness/tool_dispatcher.cpp`](https://github.com/camdenleibee/final-project/blob/main/src/harness/tool_dispatcher.cpp) (Tool Dispatcher), [`src/tools/agent_tools.cpp`](https://github.com/camdenleibee/final-project/blob/main/src/tools/agent_tools.cpp) (Agent Tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Assistant Runtime"]
  node_main["CLI Composition<br/>[main.cpp]"]
  node_harness["Turn Harness<br/>[harness.cpp]"]
  node_models["Model Clients"]
  node_transcript["Conversation Transcript<br/>[transcript.cpp]"]
end

subgraph group_tooling["Tools and Workspace"]
  node_dispatcher["Tool Dispatcher"]
  node_registry["Tool Registry<br/>[tool_registry.cpp]"]
  node_agent_tools["Agent Tools<br/>[agent_tools.cpp]"]
  node_builtin_tools["Built-in Tools<br/>[builtin_tools.cpp]"]
  node_file_tools["File Tools<br/>[file_tools.cpp]"]
  node_calculator["Calculator"]
  node_workspace["Workspace Access"]
end

subgraph group_memory["Memory and Context"]
  node_memory_store[("Memory Store<br/>[memory_store.cpp]")]
  node_memory_index["Memory Search Index<br/>[memory_index.cpp]"]
  node_context["Context Selection"]
end

subgraph group_skills["Skill Library"]
  node_skill_catalog["Skill Catalog<br/>[skill_catalog.cpp]"]
  node_dep_graph["Skill Dependencies<br/>[dep_graph.cpp]"]
  node_skill_index["Skill Search Index<br/>[skill_index.cpp]"]
end

subgraph group_safety["Command Policy"]
  node_policy_chain["Policy Chain<br/>[policy_chain.cpp]"]
  node_policies["Command Policies<br/>[policies.cpp]"]
  node_audit["Audit Log<br/>[audit_log.cpp]"]
end

node_terminal(("Terminal User"))
node_confirmer(("Terminal Confirmer"))

node_terminal -->|"provides input"| node_harness
node_main -->|"constructs"| node_harness
node_main -->|"selects client"| node_models
node_harness -.->|"requests generation"| node_models
node_harness -->|"dispatches calls"| node_dispatcher
node_dispatcher -.->|"looks up tools"| node_registry
node_main -->|"registers tools"| node_registry
node_main -->|"registers built-ins"| node_builtin_tools
node_dispatcher -.->|"invokes tool"| node_agent_tools
node_dispatcher -.->|"invokes tool"| node_file_tools
node_dispatcher -.->|"invokes tool"| node_calculator
node_agent_tools -->|"uses memory"| node_memory_store
node_agent_tools -->|"uses skills"| node_skill_catalog
node_agent_tools -.->|"checks commands"| node_policy_chain
node_agent_tools -.->|"records decisions"| node_audit
node_file_tools -.->|"uses workspace"| node_workspace
node_main -->|"loads memory"| node_memory_store
node_memory_store -.->|"indexes memories"| node_memory_index
node_harness -->|"selects context"| node_context
node_context -.->|"limits prompt"| node_models
node_main -->|"scans skills"| node_skill_catalog
node_skill_catalog -->|"orders requirements"| node_dep_graph
node_skill_catalog -->|"searches skills"| node_skill_index
node_main -->|"configures policies"| node_policy_chain
node_policy_chain -.->|"evaluates policies"| node_policies
node_main -->|"configures audit"| node_audit
node_policy_chain -.->|"requests approval"| node_confirmer
node_harness -.->|"saves conversation"| node_transcript

click node_main "https://github.com/camdenleibee/final-project/blob/main/src/main.cpp"
click node_harness "https://github.com/camdenleibee/final-project/blob/main/src/harness/harness.cpp"
click node_models "https://github.com/camdenleibee/final-project/tree/main/src/model"
click node_transcript "https://github.com/camdenleibee/final-project/blob/main/src/harness/transcript.cpp"
click node_dispatcher "https://github.com/camdenleibee/final-project/blob/main/src/harness/tool_dispatcher.cpp"
click node_registry "https://github.com/camdenleibee/final-project/blob/main/reference/p3/src/tools/tool_registry.cpp"
click node_agent_tools "https://github.com/camdenleibee/final-project/blob/main/src/tools/agent_tools.cpp"
click node_builtin_tools "https://github.com/camdenleibee/final-project/blob/main/src/tools/builtin_tools.cpp"
click node_file_tools "https://github.com/camdenleibee/final-project/blob/main/src/tools/file_tools.cpp"
click node_calculator "https://github.com/camdenleibee/final-project/blob/main/src/tools/calculator_tool.cpp"
click node_workspace "https://github.com/camdenleibee/final-project/blob/main/src/tools/workspace_provided.cpp"
click node_memory_store "https://github.com/camdenleibee/final-project/blob/main/src/memory/memory_store.cpp"
click node_memory_index "https://github.com/camdenleibee/final-project/blob/main/src/memory/memory_index.cpp"
click node_context "https://github.com/camdenleibee/final-project/blob/main/src/memory/context_builder.cpp"
click node_skill_catalog "https://github.com/camdenleibee/final-project/blob/main/src/skills/skill_catalog.cpp"
click node_dep_graph "https://github.com/camdenleibee/final-project/blob/main/src/skills/dep_graph.cpp"
click node_skill_index "https://github.com/camdenleibee/final-project/blob/main/src/skills/skill_index.cpp"
click node_policy_chain "https://github.com/camdenleibee/final-project/blob/main/src/policy/policy_chain.cpp"
click node_policies "https://github.com/camdenleibee/final-project/blob/main/src/policy/policies.cpp"
click node_audit "https://github.com/camdenleibee/final-project/blob/main/src/policy/audit_log.cpp"

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_main,node_harness,node_models,node_transcript,node_terminal toneBlue
class node_dispatcher,node_registry,node_agent_tools,node_builtin_tools,node_file_tools,node_calculator,node_workspace toneAmber
class node_memory_store,node_memory_index,node_context toneMint
class node_skill_catalog,node_dep_graph,node_skill_index toneRose
class node_policy_chain,node_policies,node_audit,node_confirmer toneIndigo
```

## Components

### Assistant Runtime

- [CLI Composition](https://github.com/camdenleibee/final-project/blob/main/src/main.cpp): `src/main.cpp`
- [Turn Harness](https://github.com/camdenleibee/final-project/blob/main/src/harness/harness.cpp): `src/harness/harness.cpp`
- [Model Clients](https://github.com/camdenleibee/final-project/tree/main/src/model): `src/model`
- [Conversation Transcript](https://github.com/camdenleibee/final-project/blob/main/src/harness/transcript.cpp): `src/harness/transcript.cpp`

### Tools and Workspace

- [Tool Dispatcher](https://github.com/camdenleibee/final-project/blob/main/src/harness/tool_dispatcher.cpp): `src/harness/tool_dispatcher.cpp`
- [Tool Registry](https://github.com/camdenleibee/final-project/blob/main/reference/p3/src/tools/tool_registry.cpp): `reference/p3/src/tools/tool_registry.cpp`
- [Agent Tools](https://github.com/camdenleibee/final-project/blob/main/src/tools/agent_tools.cpp): `src/tools/agent_tools.cpp`
- [Built-in Tools](https://github.com/camdenleibee/final-project/blob/main/src/tools/builtin_tools.cpp): `src/tools/builtin_tools.cpp`
- [File Tools](https://github.com/camdenleibee/final-project/blob/main/src/tools/file_tools.cpp): `src/tools/file_tools.cpp`
- [Calculator](https://github.com/camdenleibee/final-project/blob/main/src/tools/calculator_tool.cpp): `src/tools/calculator_tool.cpp`
- [Workspace Access](https://github.com/camdenleibee/final-project/blob/main/src/tools/workspace_provided.cpp): `src/tools/workspace_provided.cpp`

### Memory and Context

- [Memory Store](https://github.com/camdenleibee/final-project/blob/main/src/memory/memory_store.cpp): `src/memory/memory_store.cpp`
- [Memory Search Index](https://github.com/camdenleibee/final-project/blob/main/src/memory/memory_index.cpp): `src/memory/memory_index.cpp`
- [Context Selection](https://github.com/camdenleibee/final-project/blob/main/src/memory/context_builder.cpp): `src/memory/context_builder.cpp`

### Skill Library

- [Skill Catalog](https://github.com/camdenleibee/final-project/blob/main/src/skills/skill_catalog.cpp): `src/skills/skill_catalog.cpp`
- [Skill Dependencies](https://github.com/camdenleibee/final-project/blob/main/src/skills/dep_graph.cpp): `src/skills/dep_graph.cpp`
- [Skill Search Index](https://github.com/camdenleibee/final-project/blob/main/src/skills/skill_index.cpp): `src/skills/skill_index.cpp`

### Command Policy

- [Policy Chain](https://github.com/camdenleibee/final-project/blob/main/src/policy/policy_chain.cpp): `src/policy/policy_chain.cpp`
- [Command Policies](https://github.com/camdenleibee/final-project/blob/main/src/policy/policies.cpp): `src/policy/policies.cpp`
- [Audit Log](https://github.com/camdenleibee/final-project/blob/main/src/policy/audit_log.cpp): `src/policy/audit_log.cpp`

### Other components

- **Terminal User**
- **Terminal Confirmer**

## Connections

- Terminal User → Turn Harness: provides input
- CLI Composition → Turn Harness: constructs (evidence: `src/main.cpp`)
- CLI Composition → Model Clients: selects client (evidence: `src/main.cpp`)
- Turn Harness → Model Clients: requests generation (evidence: `README.md`)
- Turn Harness → Tool Dispatcher: dispatches calls
- Tool Dispatcher → Tool Registry: looks up tools
- CLI Composition → Tool Registry: registers tools (evidence: `src/main.cpp`)
- CLI Composition → Built-in Tools: registers built-ins (evidence: `src/main.cpp`)
- Tool Dispatcher → Agent Tools: invokes tool
- Tool Dispatcher → File Tools: invokes tool
- Tool Dispatcher → Calculator: invokes tool
- Agent Tools → Memory Store: uses memory (evidence: `src/tools/agent_tools.cpp`)
- Agent Tools → Skill Catalog: uses skills (evidence: `src/tools/agent_tools.cpp`)
- Agent Tools → Policy Chain: checks commands (evidence: `src/tools/agent_tools.cpp`)
- Agent Tools → Audit Log: records decisions (evidence: `src/tools/agent_tools.cpp`)
- File Tools → Workspace Access: uses workspace
- CLI Composition → Memory Store: loads memory (evidence: `src/main.cpp`)
- Memory Store → Memory Search Index: indexes memories
- Turn Harness → Context Selection: selects context
- Context Selection → Model Clients: limits prompt
- CLI Composition → Skill Catalog: scans skills (evidence: `src/main.cpp`)
- Skill Catalog → Skill Dependencies: orders requirements
- Skill Catalog → Skill Search Index: searches skills
- CLI Composition → Policy Chain: configures policies (evidence: `src/main.cpp`)
- Policy Chain → Command Policies: evaluates policies
- CLI Composition → Audit Log: configures audit (evidence: `src/main.cpp`)
- Policy Chain → Terminal Confirmer: requests approval
- Turn Harness → Conversation Transcript: saves conversation
