# akshatjen/kimevo architecture

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

- Interactive diagram: https://gitdiagram.com/akshatjen/kimevo
- Repository: https://github.com/akshatjen/kimevo

## Overview

Kimevo is a repository knowledge and change-verification tool for coding agents. The principal workflow starts with a developer invoking the CLI to initialize a repository, gather context for an agent to draft rules, decision records and ontology entries, then accept those drafts and verify them against code. Separate branches provide code-graph and impact queries, agent instructions, and Claude Code hooks. The graph shows evidenced calls and documented workflow links; unsampled command internals are represented only where the README documents their behavior.

Main entry points: [`src/bootstrap/command.ts`](https://github.com/akshatjen/kimevo/blob/main/src/bootstrap/command.ts) (Bootstrap drafts), [`src/cli.ts`](https://github.com/akshatjen/kimevo/blob/main/src/cli.ts) (Kimevo CLI), [`src/ontology/command.ts`](https://github.com/akshatjen/kimevo/blob/main/src/ontology/command.ts) (Ontology commands), [`src/decisions/records.ts`](https://github.com/akshatjen/kimevo/blob/main/src/decisions/records.ts) (Decision records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli_workflow["CLI workflow"]
  node_cli["Kimevo CLI<br/>[cli.ts]"]
  node_config["Repo configuration<br/>[config.ts]"]
  node_git["Git operations<br/>[git.ts]"]
  node_bootstrap["Bootstrap drafts<br/>[command.ts]"]
  node_gather["Context gathering<br/>[gather.ts]"]
end

subgraph group_knowledge["Repository knowledge"]
  node_rules["Rules<br/>[rules.ts]"]
  node_decisions["Decision records<br/>[records.ts]"]
  node_anchors["Code anchors<br/>[anchors.ts]"]
  node_ontology["Domain ontology<br/>[model.ts]"]
  node_ontology_commands["Ontology commands<br/>[command.ts]"]
  node_ontology_query["Ontology queries<br/>[query.ts]"]
  node_knowledge_files[("Repo knowledge files")]
end

subgraph group_code_graph["Code graph"]
  node_graph_structure["Graph extraction<br/>[structure.ts]"]
  node_api_parser["API operations<br/>[api.ts]"]
  node_graph_impact["Change impact<br/>[impact.ts]"]
  node_graph_lookup["Graph lookup<br/>[lookup.ts]"]
end

subgraph group_agent_setup["Agent setup"]
  node_init["Repository setup<br/>[init.ts]"]
  node_instructions["Agent instructions<br/>[instructions.ts]"]
end

subgraph group_checks_hooks["Checks and hooks"]
  node_verify["Verify gate<br/>[verify.ts]"]
  node_decision_check["Decision checks<br/>[check.ts]"]
  node_stop_hook["Stop hook<br/>[stop.ts]"]
  node_head_hook["Head-move hook<br/>[head-move.ts]"]
  node_pr_guard["PR size guard<br/>[pr-guard.ts]"]
end

node_developer(("Developer"))
node_claude_code(("Claude Code"))

node_developer -->|"invokes commands"| node_cli
node_cli -->|"dispatches setup"| node_init
node_cli -->|"dispatches drafting"| node_bootstrap
node_cli -->|"dispatches verification"| node_verify
node_cli -->|"dispatches ontology"| node_ontology_commands
node_bootstrap -->|"gathers context"| node_gather
node_bootstrap -->|"drafts rules"| node_rules
node_bootstrap -->|"drafts records"| node_decisions
node_bootstrap -->|"drafts ontology"| node_ontology
node_bootstrap -->|"checks drafts"| node_verify
node_init -->|"loads settings"| node_config
node_init -->|"checks tracking"| node_git
node_init -->|"sets instructions"| node_instructions
node_instructions -->|"inlines rules"| node_rules
node_instructions -->|"inlines terms"| node_ontology_query
node_ontology_commands -->|"loads ontology"| node_ontology
node_ontology_commands -->|"checks stored tables"| node_graph_structure
node_ontology_commands -->|"looks up terms"| node_graph_lookup
node_ontology_commands -->|"queries terms"| node_ontology_query
node_decisions -->|"validates symbols"| node_anchors
node_ontology -->|"reads ontology files"| node_knowledge_files
node_graph_structure -->|"extracts operations"| node_api_parser
node_graph_impact -->|"reads graph"| node_graph_structure
node_graph_lookup -->|"reads graph"| node_graph_structure
node_graph_lookup -->|"finds anchored records"| node_decisions
node_graph_lookup -->|"searches terms"| node_ontology
node_verify -->|"finds affected tests"| node_graph_impact
node_verify -->|"checks records"| node_decision_check
node_decision_check -->|"reads records"| node_decisions
node_stop_hook -->|"runs changed checks"| node_verify
node_stop_hook -->|"reviews touched records"| node_decision_check
node_head_hook -->|"finds records to review"| node_decision_check
node_pr_guard -->|"checks branch changes"| node_git
node_claude_code -->|"invokes stop event"| node_stop_hook
node_claude_code -->|"invokes head events"| node_head_hook
node_claude_code -->|"invokes edit guard"| node_pr_guard
node_rules -->|"stores rule files"| node_knowledge_files
node_decisions -->|"stores decision files"| node_knowledge_files

click node_cli "https://github.com/akshatjen/kimevo/blob/main/src/cli.ts"
click node_config "https://github.com/akshatjen/kimevo/blob/main/src/config.ts"
click node_git "https://github.com/akshatjen/kimevo/blob/main/src/git.ts"
click node_bootstrap "https://github.com/akshatjen/kimevo/blob/main/src/bootstrap/command.ts"
click node_gather "https://github.com/akshatjen/kimevo/blob/main/src/bootstrap/gather.ts"
click node_rules "https://github.com/akshatjen/kimevo/blob/main/src/rules/rules.ts"
click node_decisions "https://github.com/akshatjen/kimevo/blob/main/src/decisions/records.ts"
click node_anchors "https://github.com/akshatjen/kimevo/blob/main/src/decisions/anchors.ts"
click node_ontology "https://github.com/akshatjen/kimevo/blob/main/src/ontology/model.ts"
click node_ontology_commands "https://github.com/akshatjen/kimevo/blob/main/src/ontology/command.ts"
click node_ontology_query "https://github.com/akshatjen/kimevo/blob/main/src/ontology/query.ts"
click node_graph_structure "https://github.com/akshatjen/kimevo/blob/main/src/graph/structure.ts"
click node_api_parser "https://github.com/akshatjen/kimevo/blob/main/src/graph/api.ts"
click node_graph_impact "https://github.com/akshatjen/kimevo/blob/main/src/graph/impact.ts"
click node_graph_lookup "https://github.com/akshatjen/kimevo/blob/main/src/graph/lookup.ts"
click node_init "https://github.com/akshatjen/kimevo/blob/main/src/init/init.ts"
click node_instructions "https://github.com/akshatjen/kimevo/blob/main/src/init/instructions.ts"
click node_verify "https://github.com/akshatjen/kimevo/blob/main/src/verify.ts"
click node_decision_check "https://github.com/akshatjen/kimevo/blob/main/src/decisions/check.ts"
click node_stop_hook "https://github.com/akshatjen/kimevo/blob/main/src/hooks/stop.ts"
click node_head_hook "https://github.com/akshatjen/kimevo/blob/main/src/hooks/head-move.ts"
click node_pr_guard "https://github.com/akshatjen/kimevo/blob/main/src/hooks/pr-guard.ts"

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_config,node_git,node_bootstrap,node_gather toneBlue
class node_rules,node_decisions,node_anchors,node_ontology,node_ontology_commands,node_ontology_query,node_knowledge_files toneAmber
class node_graph_structure,node_api_parser,node_graph_impact,node_graph_lookup toneMint
class node_init,node_instructions toneRose
class node_verify,node_decision_check,node_stop_hook,node_head_hook,node_pr_guard,node_developer,node_claude_code toneIndigo
```

## Components

### CLI workflow

- [Kimevo CLI](https://github.com/akshatjen/kimevo/blob/main/src/cli.ts): `src/cli.ts`
- [Repo configuration](https://github.com/akshatjen/kimevo/blob/main/src/config.ts): `src/config.ts`
- [Git operations](https://github.com/akshatjen/kimevo/blob/main/src/git.ts): `src/git.ts`
- [Bootstrap drafts](https://github.com/akshatjen/kimevo/blob/main/src/bootstrap/command.ts): `src/bootstrap/command.ts`
- [Context gathering](https://github.com/akshatjen/kimevo/blob/main/src/bootstrap/gather.ts): `src/bootstrap/gather.ts`

### Repository knowledge

- [Rules](https://github.com/akshatjen/kimevo/blob/main/src/rules/rules.ts): `src/rules/rules.ts`
- [Decision records](https://github.com/akshatjen/kimevo/blob/main/src/decisions/records.ts): `src/decisions/records.ts`
- [Code anchors](https://github.com/akshatjen/kimevo/blob/main/src/decisions/anchors.ts): `src/decisions/anchors.ts`
- [Domain ontology](https://github.com/akshatjen/kimevo/blob/main/src/ontology/model.ts): `src/ontology/model.ts`
- [Ontology commands](https://github.com/akshatjen/kimevo/blob/main/src/ontology/command.ts): `src/ontology/command.ts`
- [Ontology queries](https://github.com/akshatjen/kimevo/blob/main/src/ontology/query.ts): `src/ontology/query.ts`
- **Repo knowledge files**

### Code graph

- [Graph extraction](https://github.com/akshatjen/kimevo/blob/main/src/graph/structure.ts): `src/graph/structure.ts`
- [API operations](https://github.com/akshatjen/kimevo/blob/main/src/graph/api.ts): `src/graph/api.ts`
- [Change impact](https://github.com/akshatjen/kimevo/blob/main/src/graph/impact.ts): `src/graph/impact.ts`
- [Graph lookup](https://github.com/akshatjen/kimevo/blob/main/src/graph/lookup.ts): `src/graph/lookup.ts`

### Agent setup

- [Repository setup](https://github.com/akshatjen/kimevo/blob/main/src/init/init.ts): `src/init/init.ts`
- [Agent instructions](https://github.com/akshatjen/kimevo/blob/main/src/init/instructions.ts): `src/init/instructions.ts`

### Checks and hooks

- [Verify gate](https://github.com/akshatjen/kimevo/blob/main/src/verify.ts): `src/verify.ts`
- [Decision checks](https://github.com/akshatjen/kimevo/blob/main/src/decisions/check.ts): `src/decisions/check.ts`
- [Stop hook](https://github.com/akshatjen/kimevo/blob/main/src/hooks/stop.ts): `src/hooks/stop.ts`
- [Head-move hook](https://github.com/akshatjen/kimevo/blob/main/src/hooks/head-move.ts): `src/hooks/head-move.ts`
- [PR size guard](https://github.com/akshatjen/kimevo/blob/main/src/hooks/pr-guard.ts): `src/hooks/pr-guard.ts`

### Other components

- **Developer**
- **Claude Code**

## Connections

- Developer → Kimevo CLI: invokes commands (evidence: `README.md`)
- Kimevo CLI → Repository setup: dispatches setup (evidence: `src/cli.ts`)
- Kimevo CLI → Bootstrap drafts: dispatches drafting (evidence: `src/cli.ts`)
- Kimevo CLI → Verify gate: dispatches verification (evidence: `src/cli.ts`)
- Kimevo CLI → Ontology commands: dispatches ontology (evidence: `src/cli.ts`)
- Bootstrap drafts → Context gathering: gathers context (evidence: `src/bootstrap/command.ts`)
- Bootstrap drafts → Rules: drafts rules (evidence: `src/bootstrap/command.ts`)
- Bootstrap drafts → Decision records: drafts records (evidence: `src/bootstrap/command.ts`)
- Bootstrap drafts → Domain ontology: drafts ontology (evidence: `src/bootstrap/command.ts`)
- Bootstrap drafts → Verify gate: checks drafts (evidence: `src/bootstrap/command.ts`)
- Repository setup → Repo configuration: loads settings (evidence: `src/init/init.ts`)
- Repository setup → Git operations: checks tracking (evidence: `src/init/init.ts`)
- Repository setup → Agent instructions: sets instructions (evidence: `src/init/init.ts`)
- Agent instructions → Rules: inlines rules (evidence: `src/init/instructions.ts`)
- Agent instructions → Ontology queries: inlines terms (evidence: `src/init/instructions.ts`)
- Ontology commands → Domain ontology: loads ontology (evidence: `src/ontology/command.ts`)
- Ontology commands → Graph extraction: checks stored tables (evidence: `src/ontology/command.ts`)
- Ontology commands → Graph lookup: looks up terms (evidence: `src/ontology/command.ts`)
- Ontology commands → Ontology queries: queries terms (evidence: `src/ontology/command.ts`)
- Decision records → Code anchors: validates symbols (evidence: `src/decisions/records.ts`)
- Domain ontology → Repo knowledge files: reads ontology files (evidence: `src/ontology/model.ts`)
- Graph extraction → API operations: extracts operations (evidence: `src/graph/structure.ts`)
- Change impact → Graph extraction: reads graph (evidence: `src/graph/impact.ts`)
- Graph lookup → Graph extraction: reads graph (evidence: `src/graph/lookup.ts`)
- Graph lookup → Decision records: finds anchored records (evidence: `src/graph/lookup.ts`)
- Graph lookup → Domain ontology: searches terms (evidence: `src/graph/lookup.ts`)
- Verify gate → Change impact: finds affected tests (evidence: `src/verify.ts`)
- Verify gate → Decision checks: checks records (evidence: `src/verify.ts`)
- Decision checks → Decision records: reads records (evidence: `src/decisions/check.ts`)
- Stop hook → Verify gate: runs changed checks (evidence: `src/hooks/stop.ts`)
- Stop hook → Decision checks: reviews touched records (evidence: `src/hooks/stop.ts`)
- Head-move hook → Decision checks: finds records to review (evidence: `src/hooks/head-move.ts`)
- PR size guard → Git operations: checks branch changes (evidence: `src/hooks/pr-guard.ts`)
- Claude Code → Stop hook: invokes stop event (evidence: `README.md`)
- Claude Code → Head-move hook: invokes head events (evidence: `README.md`)
- Claude Code → PR size guard: invokes edit guard (evidence: `README.md`)
- Rules → Repo knowledge files: stores rule files (evidence: `README.md`)
- Decision records → Repo knowledge files: stores decision files (evidence: `README.md`)
