# sorensencc-dotcom/toolforge architecture

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

- Interactive diagram: https://gitdiagram.com/sorensencc-dotcom/toolforge
- Repository: https://github.com/sorensencc-dotcom/toolforge

## Overview

Toolforge is a governed AI-tool platform: agents discover tools and submit invocations, which are intended to pass through authorization, validation, isolated execution, and observable result reporting. The tree also shows adjacent marketplace, Cowork registration, TorqueQuery routing, and operational capabilities. The README documents the high-level execution stages, but their implementations are not all present in the supplied tree; the graph therefore avoids asserting undocumented wiring between those subsystems.

Main entry points: [`modules/TorqueQueryOrchestrator.mjs`](https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/TorqueQueryOrchestrator.mjs) (TorqueQuery routing), [`skills/toolforge-cli/src/invocation-worker.mjs`](https://github.com/sorensencc-dotcom/toolforge/blob/main/skills/toolforge-cli/src/invocation-worker.mjs) (Invocation worker), [`src/api/server.js`](https://github.com/sorensencc-dotcom/toolforge/blob/main/src/api/server.js) (Marketplace API), [`gateway/cowork/src/registry/SkillRegistry.ts`](https://github.com/sorensencc-dotcom/toolforge/blob/main/gateway/cowork/src/registry/SkillRegistry.ts) (Skill registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Ingress and discovery"]
  node_market_api["Marketplace API<br/>[server.js]"]
  node_market_ui["Marketplace UI<br/>[App.jsx]"]
  node_cowork_registration["Skill registration"]
  node_skill_registry[("Skill registry<br/>[SkillRegistry.ts]")]
end

subgraph group_govern["Governance and routing"]
  node_invocation_contract["Invocation contract"]
  node_torque_orchestrator["TorqueQuery routing"]
  node_routing_runtime["Governed dispatch"]
  node_routing_adapter["Routing adapter"]
end

subgraph group_runtime["Execution and integrations"]
  node_invocation_worker["Invocation worker"]
  node_skill_invoker["Skill invocation<br/>[invoke-skill.mjs]"]
  node_retrieval["Knowledge retrieval"]
  node_llm_adapter["Model adapter"]
end

subgraph group_ops["Operations and observability"]
  node_trm_mcp["TRM operations MCP<br/>[server.ts]"]
  node_trm_reconciler["Queue reconciliation<br/>[reconciler.ts]"]
  node_telemetry_server["Telemetry service<br/>[server.js]"]
end

node_agent(("AI agent"))

node_agent -->|"requests tools"| node_market_api
node_market_ui -.->|"uses API"| node_market_api
node_market_api -.->|"discovers skills"| node_skill_registry
node_cowork_registration -->|"registers skills"| node_skill_registry
node_agent -.->|"submits invocation"| node_invocation_worker
node_invocation_worker -->|"uses contract"| node_invocation_contract
node_invocation_worker -->|"delegates invocation"| node_skill_invoker
node_agent -.->|"requests routed work"| node_torque_orchestrator
node_torque_orchestrator -->|"queries context"| node_retrieval
node_torque_orchestrator -->|"checks model gate"| node_llm_adapter
node_routing_adapter -->|"evaluates route"| node_routing_runtime
node_trm_mcp -->|"reconciles queue"| node_trm_reconciler

click node_market_api "https://github.com/sorensencc-dotcom/toolforge/blob/main/src/api/server.js"
click node_market_ui "https://github.com/sorensencc-dotcom/toolforge/blob/main/src/ui/App.jsx"
click node_cowork_registration "https://github.com/sorensencc-dotcom/toolforge/blob/main/gateway/cowork/src/registry/RegistrationManager.ts"
click node_skill_registry "https://github.com/sorensencc-dotcom/toolforge/blob/main/gateway/cowork/src/registry/SkillRegistry.ts"
click node_invocation_contract "https://github.com/sorensencc-dotcom/toolforge/blob/main/skills/toolforge-cli/src/invocation-contracts.mjs"
click node_invocation_worker "https://github.com/sorensencc-dotcom/toolforge/blob/main/skills/toolforge-cli/src/invocation-worker.mjs"
click node_skill_invoker "https://github.com/sorensencc-dotcom/toolforge/blob/main/skills/toolforge-cli/src/invoke-skill.mjs"
click node_torque_orchestrator "https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/TorqueQueryOrchestrator.mjs"
click node_routing_runtime "https://github.com/sorensencc-dotcom/toolforge/blob/main/CIC-GOVERNANCE/WRAPPERS/torquequery_routing_runtime.py"
click node_routing_adapter "https://github.com/sorensencc-dotcom/toolforge/blob/main/CIC-GOVERNANCE/adapters/torquequery_routing_adapter.py"
click node_retrieval "https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/adapters/IcfRetrievalAdapter-v2.mjs"
click node_llm_adapter "https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/adapters/WhichLlmAdapter.mjs"
click node_trm_mcp "https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/trm-devops/src/mcp/server.ts"
click node_trm_reconciler "https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/trm-devops/src/core/reconciler.ts"
click node_telemetry_server "https://github.com/sorensencc-dotcom/toolforge/blob/main/api/telemetry/server.js"

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_market_api,node_market_ui,node_cowork_registration,node_skill_registry toneBlue
class node_invocation_contract,node_torque_orchestrator,node_routing_runtime,node_routing_adapter toneAmber
class node_invocation_worker,node_skill_invoker,node_retrieval,node_llm_adapter toneMint
class node_trm_mcp,node_trm_reconciler,node_telemetry_server toneRose
class node_agent toneIndigo
```

## Components

### Ingress and discovery

- [Marketplace API](https://github.com/sorensencc-dotcom/toolforge/blob/main/src/api/server.js): `src/api/server.js`
- [Marketplace UI](https://github.com/sorensencc-dotcom/toolforge/blob/main/src/ui/App.jsx): `src/ui/App.jsx`
- [Skill registration](https://github.com/sorensencc-dotcom/toolforge/blob/main/gateway/cowork/src/registry/RegistrationManager.ts): `gateway/cowork/src/registry/RegistrationManager.ts`
- [Skill registry](https://github.com/sorensencc-dotcom/toolforge/blob/main/gateway/cowork/src/registry/SkillRegistry.ts): `gateway/cowork/src/registry/SkillRegistry.ts`

### Governance and routing

- [Invocation contract](https://github.com/sorensencc-dotcom/toolforge/blob/main/skills/toolforge-cli/src/invocation-contracts.mjs): `skills/toolforge-cli/src/invocation-contracts.mjs`
- [TorqueQuery routing](https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/TorqueQueryOrchestrator.mjs): `modules/TorqueQueryOrchestrator.mjs`
- [Governed dispatch](https://github.com/sorensencc-dotcom/toolforge/blob/main/CIC-GOVERNANCE/WRAPPERS/torquequery_routing_runtime.py): `CIC-GOVERNANCE/WRAPPERS/torquequery_routing_runtime.py`
- [Routing adapter](https://github.com/sorensencc-dotcom/toolforge/blob/main/CIC-GOVERNANCE/adapters/torquequery_routing_adapter.py): `CIC-GOVERNANCE/adapters/torquequery_routing_adapter.py`

### Execution and integrations

- [Invocation worker](https://github.com/sorensencc-dotcom/toolforge/blob/main/skills/toolforge-cli/src/invocation-worker.mjs): `skills/toolforge-cli/src/invocation-worker.mjs`
- [Skill invocation](https://github.com/sorensencc-dotcom/toolforge/blob/main/skills/toolforge-cli/src/invoke-skill.mjs): `skills/toolforge-cli/src/invoke-skill.mjs`
- [Knowledge retrieval](https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/adapters/IcfRetrievalAdapter-v2.mjs): `modules/adapters/IcfRetrievalAdapter-v2.mjs`
- [Model adapter](https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/adapters/WhichLlmAdapter.mjs): `modules/adapters/WhichLlmAdapter.mjs`

### Operations and observability

- [TRM operations MCP](https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/trm-devops/src/mcp/server.ts): `modules/trm-devops/src/mcp/server.ts`
- [Queue reconciliation](https://github.com/sorensencc-dotcom/toolforge/blob/main/modules/trm-devops/src/core/reconciler.ts): `modules/trm-devops/src/core/reconciler.ts`
- [Telemetry service](https://github.com/sorensencc-dotcom/toolforge/blob/main/api/telemetry/server.js): `api/telemetry/server.js`

### Other components

- **AI agent**

## Connections

- AI agent → Marketplace API: requests tools (evidence: `README.md`)
- Marketplace UI → Marketplace API: uses API
- Marketplace API → Skill registry: discovers skills
- Skill registration → Skill registry: registers skills (evidence: `gateway/cowork/src/registry/RegistrationManager.ts`)
- AI agent → Invocation worker: submits invocation
- Invocation worker → Invocation contract: uses contract (evidence: `skills/toolforge-cli/src/invocation-worker.mjs`)
- Invocation worker → Skill invocation: delegates invocation (evidence: `skills/toolforge-cli/src/invocation-worker.mjs`)
- AI agent → TorqueQuery routing: requests routed work
- TorqueQuery routing → Knowledge retrieval: queries context (evidence: `modules/TorqueQueryOrchestrator.mjs`)
- TorqueQuery routing → Model adapter: checks model gate (evidence: `modules/TorqueQueryOrchestrator.mjs`)
- Routing adapter → Governed dispatch: evaluates route (evidence: `CIC-GOVERNANCE/adapters/torquequery_routing_adapter.py`)
- TRM operations MCP → Queue reconciliation: reconciles queue (evidence: `modules/trm-devops/src/mcp/server.ts`)
