# josh-paul/praxis-os architecture

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

- Interactive diagram: https://gitdiagram.com/josh-paul/praxis-os
- Repository: https://github.com/josh-paul/praxis-os

## Overview

1. This repo is a portable AI-agent framework, not a single app. Its core product is a Python MCP server plus a large content layer of standards and workflow definitions that get installed into another project’s local `.praxis-os/` directory.

2. There are three major boundaries:
   - **Executable runtime**: the Python server in `.praxis-os/ouroboros/` and the mirrored `dist/ouroboros/`
   - **Knowledge/content**: standards, workflows, specs, and generated guidance under `.praxis-os/standards`, `.praxis-os/workflows`, `universal/`, `workflow-authoring/`, and `language-instructions/`
   - **Distribution/install tooling**: `scripts/`, `installation/`, and the packaged `dist/` tree

3. The server runtime is organized as a layered Python package:
   - `server.py`, `mcp.py`, and `__main__.py` expose the MCP entrypoint
   - `config/` loads typed configuration and schemas
   - `foundation/` handles process/runtime concerns like locks, ports, session mapping, transport selection, and state management
   - `middleware/` injects cross-cutting behavior such as query classification, session ID extraction, and query tracking

4. The main functional subsystems are under `subsystems/`:
   - **RAG**: code and standards retrieval, indexing, locking, watching, and vector storage helpers
   - **Workflow**: phase-gated workflow loading, parsing, rendering, evidence validation, and dynamic workflow registry
   - **Browser**: browser/session-oriented tooling and state models
   These are the main runtime services that MCP tools delegate to.

5. The RAG subsystem is the data/indexing backbone. It uses AST-aware code chunking, semantic indexing, graph traversal, reconciliation, and storage helpers for LanceDB and DuckDB. The watcher and lock manager indicate the index is meant to rebuild incrementally and safely while the server is running.

6. Workflow execution is definition-driven. Workflows are stored as YAML/Markdown phase trees under `workflows/` and parsed by the workflow subsystem into validated phases, tasks, and gates. The engine, parser modules, and `phase_gates.py` form the execution path from static definitions to runtime guidance.

7. MCP tools are the public API surface. Tool implementations live in `.praxis-os/ouroboros/tools/` and are registered through the tool registry. They expose project info, current date, browser operations, filesystem/search operations, and workflow operations to connected IDE agents.

8. The installation path is a second major flow. `installation/` and the root `scripts/install-praxis-os.py` / `scripts/configure-claude-code-mcp.py` / `scripts/update-cline-mcp.py` copy the framework into a target project, create the `.praxis-os/` directory structure, set up the virtual environment, and write IDE-specific MCP config such as `.cursor/mcp.json` or `.claude/CLAUDE.md`.

9. Runtime state is intentionally local to each consuming project. The `.praxis-os/state/` tree stores workflow and browser session artifacts, `.praxis-os/logs/` stores server logs, and `.praxis-os/.cache/` stores the vector index and other ephemeral build data. This isolates each project’s knowledge base and avoids shared mutable infrastructure.

10. The `dist/` tree is the packaged consumer artifact. It mirrors the source layout so the repo can distribute the same standards, workflows, server package, and universal content that the installer copies into target projects. In architecture terms, `dist/` is the release boundary, while the repo root is the development/dogfooding boundary.

11. Documentation is not just reference material here; it is part of the system. `docs/` is a Docusaurus site that explains the architecture, installation, and workflows, while `.praxis-os/specs/` and `workspace/analysis` capture design decisions, evaluations, and completed feature specs that feed future workflow and standards changes.

12. Validation is multi-layered. There are unit, integration, performance, and repo-level tests under `.praxis-os/tests/` and `tests/`, plus pre-commit scripts, YAML/docs validators, and workflow metadata checks. This supports the repo’s emphasis on schema correctness, thread safety, and safe operational updates.

13. The highest-level data flow is:
   user/IDE command -> MCP transport -> server middleware -> tool registry -> RAG/workflow/browser subsystem -> local state/index/logs -> response back to the agent.
   The key architectural idea is that the server is stateless in concept but stateful per-project through `.praxis-os/`.

14. Dual-transport support adds a second ingress path. Primary IDEs connect over stdio, while sub-agents can discover and use the same server over HTTP via `.praxis-os/.mcp_server_state.json`. That introduces a clear transport boundary without changing the core tool and subsystem model.

Main entry points: [`.praxis-os/ouroboros/tools/registry.py`](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/tools/registry.py) (Tool registry), [`.praxis-os/ouroboros/subsystems/rag`](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/subsystems/rag) (RAG), [`.praxis-os/ouroboros/subsystems/workflow`](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/subsystems/workflow) (Workflow), [`.praxis-os/ouroboros/server.py`](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/server.py) (MCP entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_entrypoint["MCP entry<br/>python entrypoint<br/>[server.py]"]
  node_config["Config<br/>[loader.py]"]
  node_foundation["Foundation<br/>runtime core<br/>[foundation]"]
  node_middleware["Middleware<br/>cross-cutting<br/>[middleware]"]
  node_tools["Tool registry<br/>MCP tools<br/>[registry.py]"]
  node_rag["RAG<br/>retrieval/indexing<br/>[rag]"]
  node_workflow["Workflow<br/>[workflow]"]
  node_browser["Browser<br/>[browser]"]
end

subgraph group_content["Content"]
  node_standards["Standards<br/>knowledge base<br/>[standards]"]
  node_workflows["Workflows<br/>definitions<br/>[workflows]"]
  node_specs["Specs<br/>decision history<br/>[specs]"]
  node_universal["Universal content<br/>shared content"]
end

subgraph group_distribution["Distribution"]
  node_distserver["Packaged server<br/>release runtime"]
  node_distcontent["Packaged content<br/>release content"]
end

subgraph group_tooling["Tooling"]
  node_installer["Installer<br/>install scripts"]
  node_configure["IDE config<br/>mcp setup"]
  node_upgrade["Upgrade tools<br/>maintenance"]
end

subgraph group_docs["Docs"]
  node_docs["Docs site<br/>documentation site"]
end

subgraph group_state["Local State"]
  node_localstate[("Project state<br/>[state]")]
end

subgraph group_validation["Validation"]
  node_tests["Validation<br/>test suite<br/>[tests]"]
end

node_entrypoint -->|"loads"| node_config
node_entrypoint -->|"wraps"| node_middleware
node_entrypoint -->|"serves"| node_tools
node_middleware -->|"routes"| node_tools
node_tools -->|"delegates"| node_rag
node_tools -->|"delegates"| node_workflow
node_tools -->|"delegates"| node_browser
node_rag -->|"indexes"| node_standards
node_rag -->|"indexes"| node_workflows
node_workflow -->|"parses"| node_workflows
node_workflow -->|"consumes"| node_specs
node_rag -->|"stores"| node_localstate
node_workflow -->|"writes"| node_localstate
node_browser -->|"persists"| node_localstate
node_installer -->|"copies"| node_distserver
node_installer -->|"copies"| node_distcontent
node_configure -->|"supports"| node_installer
node_upgrade -->|"updates"| node_distserver
node_upgrade -->|"updates"| node_distcontent
node_docs -->|"documents"| node_standards
node_docs -->|"documents"| node_workflows
node_universal -->|"mirrors"| node_distcontent
node_distserver -->|"mirrors"| node_entrypoint
node_distcontent -->|"packages"| node_standards
node_distcontent -->|"packages"| node_workflows
node_tests -->|"validates"| node_entrypoint
node_tests -->|"validates"| node_rag
node_tests -->|"validates"| node_workflow

click node_entrypoint "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/server.py"
click node_config "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/config/loader.py"
click node_foundation "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/foundation"
click node_middleware "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/middleware"
click node_tools "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/tools/registry.py"
click node_rag "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/subsystems/rag"
click node_workflow "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/subsystems/workflow"
click node_browser "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/subsystems/browser"
click node_standards "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/standards"
click node_workflows "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/workflows"
click node_specs "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/specs"
click node_universal "https://github.com/josh-paul/praxis-os/tree/main/dist/universal"
click node_installer "https://github.com/josh-paul/praxis-os/blob/main/scripts/install-praxis-os.py"
click node_configure "https://github.com/josh-paul/praxis-os/blob/main/scripts/configure-claude-code-mcp.py"
click node_upgrade "https://github.com/josh-paul/praxis-os/blob/main/scripts/upgrade-praxis-os.py"
click node_distserver "https://github.com/josh-paul/praxis-os/tree/main/dist/ouroboros"
click node_distcontent "https://github.com/josh-paul/praxis-os/tree/main/dist/universal"
click node_localstate "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/state"
click node_tests "https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/tests"
click node_docs "https://github.com/josh-paul/praxis-os/tree/main/docs"

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_entrypoint,node_config,node_foundation,node_middleware,node_tools,node_rag,node_workflow,node_browser,node_tests toneBlue
class node_standards,node_workflows,node_specs,node_universal toneAmber
class node_distserver,node_distcontent toneMint
class node_installer,node_configure,node_upgrade toneRose
class node_docs toneIndigo
class node_localstate toneTeal
```

## Components

### Runtime

Executable MCP server and tool runtime

- [MCP entry](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/server.py): python entrypoint · Server startup and transport entrypoints · `.praxis-os/ouroboros/server.py`
- [Config](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/config/loader.py): typed config · Loads schemas and runtime configuration · `.praxis-os/ouroboros/config/loader.py`
- [Foundation](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/foundation): runtime core · Locks, ports, transport selection, project/session state · `.praxis-os/ouroboros/foundation`
- [Middleware](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/middleware): cross-cutting · Query classification, session extraction, query tracking · `.praxis-os/ouroboros/middleware`
- [Tool registry](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/tools/registry.py): MCP tools · Registers the public MCP tool surface · `.praxis-os/ouroboros/tools/registry.py`
- [RAG](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/subsystems/rag): retrieval/indexing · Code and standards retrieval, indexing, storage, and watching · `.praxis-os/ouroboros/subsystems/rag`
- [Workflow](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/subsystems/workflow): workflow engine · Parses, validates, gates, and renders workflow definitions · `.praxis-os/ouroboros/subsystems/workflow`
- [Browser](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/ouroboros/subsystems/browser): browser tools · Browser/session-oriented tooling and state models · `.praxis-os/ouroboros/subsystems/browser`

### Content

Standards, workflows, specs, and generated guidance

- [Standards](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/standards): knowledge base · Development and universal standards content · `.praxis-os/standards`
- [Workflows](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/workflows): definitions · YAML and Markdown workflow phase trees · `.praxis-os/workflows`
- [Specs](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/specs): decision history · Approved, completed, and reviewed specs plus analyses · `.praxis-os/specs`
- [Universal content](https://github.com/josh-paul/praxis-os/tree/main/dist/universal): shared content · Packaged cross-project standards and templates · `dist/universal`

### Distribution

Packaged release artifacts and install targets

- [Packaged server](https://github.com/josh-paul/praxis-os/tree/main/dist/ouroboros): release runtime · Mirrored executable runtime shipped to consumers · `dist/ouroboros`
- [Packaged content](https://github.com/josh-paul/praxis-os/tree/main/dist/universal): release content · Release copy of standards, workflows, and universal assets · `dist/universal`

### Tooling

Installers, builders, and maintenance scripts

- [Installer](https://github.com/josh-paul/praxis-os/blob/main/scripts/install-praxis-os.py): install scripts · Copies the framework into target projects and writes IDE config · `scripts/install-praxis-os.py`
- [IDE config](https://github.com/josh-paul/praxis-os/blob/main/scripts/configure-claude-code-mcp.py): mcp setup · Generates Claude/Cursor/Cline MCP configuration · `scripts/configure-claude-code-mcp.py`
- [Upgrade tools](https://github.com/josh-paul/praxis-os/blob/main/scripts/upgrade-praxis-os.py): maintenance · Safe upgrade and dist sync utilities · `scripts/upgrade-praxis-os.py`

### Docs

Documentation site and authored architecture notes

- [Docs site](https://github.com/josh-paul/praxis-os/tree/main/docs): documentation site · Architecture, installation, and workflow documentation · `docs`

### Local State

Per-project runtime artifacts and ephemeral data

- [Project state](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/state): per-project state · Workflow artifacts, browser sessions, logs, and cache · `.praxis-os/state`

### Validation

Tests and repository checks

- [Validation](https://github.com/josh-paul/praxis-os/blob/main/.praxis-os/tests): test suite · Unit, integration, performance, and repo-level checks · `.praxis-os/tests`

## Connections

- MCP entry → Config: loads · Startup reads typed config and schemas
- MCP entry → Middleware: wraps · Requests pass through cross-cutting middleware
- MCP entry → Tool registry: serves · MCP entrypoint exposes registered tools
- Middleware → Tool registry: routes · Classified requests are delegated to tools
- Tool registry → RAG: delegates · Search and discovery tools use the retrieval subsystem
- Tool registry → Workflow: delegates · Workflow tools use the workflow subsystem
- Tool registry → Browser: delegates · Browser tools use browser/session subsystem
- RAG → Standards: indexes · RAG ingests standards and project knowledge
- RAG → Workflows: indexes · RAG also reads workflow definitions and supporting docs
- Workflow → Workflows: parses · Workflow engine loads YAML and Markdown phase trees
- Workflow → Specs: consumes · Specs and analysis documents inform workflow guidance
- RAG → Project state: stores · Vector index and cache are kept in local project state
- Workflow → Project state: writes · Workflow sessions and artifacts are persisted locally
- Browser → Project state: persists · Browser session artifacts live in project-local state
- Installer → Packaged server: copies · Installer brings the packaged runtime into target projects
- Installer → Packaged content: copies · Installer installs packaged standards and workflows
- IDE config → Installer: supports · IDE config scripts complement installation flow
- Upgrade tools → Packaged server: updates · Upgrade path refreshes the packaged runtime
- Upgrade tools → Packaged content: updates · Upgrade path refreshes packaged content
- Docs site → Standards: documents · Docs site explains the standards and operating model
- Docs site → Workflows: documents · Docs site explains workflows and installation
- Universal content → Packaged content: mirrors · Release artifact mirrors shared universal content
- Packaged server → MCP entry: mirrors · Release server mirrors source runtime layout
- Packaged content → Standards: packages · Packaged content is derived from source standards
- Packaged content → Workflows: packages · Packaged content is derived from source workflows
- Validation → MCP entry: validates · Tests cover runtime behavior and server integration
- Validation → RAG: validates · Tests cover indexing and retrieval behavior
- Validation → Workflow: validates · Tests cover parser, gates, and workflow execution
