class-ai-agent 1.6.1 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.agent/SESSION.md CHANGED
@@ -46,6 +46,7 @@ Maintain and ship **class-ai-agent** — production-grade AI agent scaffolding f
46
46
 
47
47
  - Calling `codegraph_context` with `{ "query": "...", "limit": 15 }` → `task must be a non-empty string`.
48
48
  - CodeGraph MCP may need `projectPath` if workspace root is not detected.
49
+ - OntoSight with bare `.` may load the wrong project's graph — pass absolute workspace root as `[project-path]`; run `codegraph_status` first.
49
50
  - CLI smoke test: `npm run test:cli`
50
51
  - `npx class-ai-agent` runs CodeGraph init by default; set `CODEGRAPH_SKIP_INIT=1` to skip.
51
52
 
@@ -28,7 +28,7 @@ Supporting workflows: `debug`, `simplify`, `fix-issue`, `handoff`, `resume` in `
28
28
  - Prefer **tests first** and **small vertical slices** (see `.agents/skills/incremental-implementation/`).
29
29
  - Use **`.agents/references/`** for checklists (security, testing, performance, accessibility).
30
30
  - For **structural** code questions, prefer **CodeGraph** MCP tools per **`.agent/rules/codegraph.md`**.
31
- - When the user wants a **visual call graph**, use **OntoSight CLI** per **`.agent/rules/ontosight.md`** (`npx @royalsolution/ontosight`).
31
+ - When the user wants a **visual call graph**, use **OntoSight CLI** per **`.agent/rules/ontosight.md`** (`npx @royalsolution/ontosight@0.2.0`).
32
32
 
33
33
  ## Agents (personas)
34
34
 
@@ -23,7 +23,7 @@ Use codegraph for **structural** questions — what calls what, what would break
23
23
  | "See several related symbols' source at once" | `codegraph_explore` |
24
24
  | "What files exist under path/" | `codegraph_files` |
25
25
  | "Is the index healthy?" | `codegraph_status` |
26
- | Visual exploration of a subgraph in browser | `npx @royalsolution/ontosight` (see **`.agent/rules/ontosight.md`**) |
26
+ | Visual exploration of a subgraph in browser | `npx @royalsolution/ontosight@0.2.0` (see **`.agent/rules/ontosight.md`**) |
27
27
  | "Show/demonstrate impact of changing Z" | `codegraph_impact` → then OntoSight `--symbol Z` (see **`.agent/rules/ontosight.md`**) |
28
28
 
29
29
  ### Visualization
@@ -32,6 +32,8 @@ For interactive call-graph UI (user asks to "show the graph" or explore architec
32
32
 
33
33
  For **impact demonstration** requests ("show impact", "blast radius", "what breaks if I change X"), run `codegraph_impact` first, present a text summary, then open OntoSight — never stop at MCP text alone when the user wants to see or show impact.
34
34
 
35
+ **Project graph fidelity:** OntoSight is a separate CLI — MCP `${workspaceFolder}` binding does not apply automatically. Pass the **same workspace root** to OntoSight's `[project-path]` as you use for `projectPath` on `codegraph_*` calls when MCP cwd detection is wrong. Run `codegraph_status` before opening OntoSight; seeds (`--symbol`, `--task`) must come from queries against that same index. See **Project graph fidelity** in **`.agent/rules/ontosight.md`**.
36
+
35
37
  ### Tool parameters (do not mix)
36
38
 
37
39
  | Tool | Required arg | Optional cap | Wrong args → error |
@@ -14,12 +14,50 @@ See **`.agent/rules/codegraph.md`** for MCP usage and **`.agents/references/onto
14
14
  | Goal | Use |
15
15
  |------|-----|
16
16
  | Find symbols, callers, traces, impact (text in chat) | `codegraph_*` MCP tools |
17
- | Visual exploration of a subgraph | `npx @royalsolution/ontosight` |
17
+ | Visual exploration of a subgraph | `npx @royalsolution/ontosight@0.2.0` |
18
18
  | User says "show me the graph" | OntoSight CLI |
19
19
  | Impact / blast radius demonstration | `codegraph_impact` → summary → OntoSight CLI |
20
20
 
21
21
  Rule of thumb: gather facts with CodeGraph MCP; open OntoSight when visualization helps the human explore complexity you already identified.
22
22
 
23
+ ### Project graph fidelity
24
+
25
+ OntoSight reads nodes from `.codegraph/codegraph.db` under the **`[project-path]`** argument (default: shell `cwd`). The browser must show **this workspace's** project graph — never a foreign repo or auto-init index from the wrong directory.
26
+
27
+ **Mandatory preflight** (before any OntoSight run):
28
+
29
+ 1. Resolve **workspace root** (Cursor `${workspaceFolder}` / absolute path from user context).
30
+ 2. `codegraph_status({ projectPath: "<workspace-root>" })` when MCP may be on wrong cwd; otherwise default.
31
+ 3. If index missing → `npx @colbymchenry/codegraph init -i` **in workspace root** (ask user on large repos).
32
+ 4. If MCP returns "wrong project" / path mismatch → pass `projectPath` on all subsequent `codegraph_*` calls.
33
+
34
+ **Hard rule:** Do not open OntoSight until `.codegraph/codegraph.db` exists under the **target workspace root**.
35
+
36
+ **Absolute project path** — never rely on bare `.` when workspace root is known:
37
+
38
+ ```bash
39
+ # Required when workspace root is known
40
+ npx @royalsolution/ontosight@0.2.0 "/absolute/path/to/workspace" \
41
+ --symbol <name> --path <dir>
42
+ ```
43
+
44
+ Pass workspace root as the **first positional `[project-path]`** argument. Optionally set shell `cwd` to workspace root as well — but always pass the absolute path.
45
+
46
+ **Seed binding** — seeds must come from the same project's CodeGraph index:
47
+
48
+ | Seed mode | Requirement |
49
+ |-----------|-------------|
50
+ | `--symbol` | Name **must** come from `codegraph_search` / `codegraph_context` with the **same** `projectPath`; `--path` must match the directory prefix of the returned file path |
51
+ | `--task` | Only after `codegraph_context({ task, maxNodes })`; prefer `--symbol` when user named a symbol |
52
+ | Default (no seed) | Full-project exploration only; still require absolute workspace path |
53
+
54
+ **Anti-patterns (explicit ban):**
55
+
56
+ - Do not use README/doc example symbols (`view_graph`, `deleteUser`) unless `codegraph_search` confirms they exist in **this** project.
57
+ - Do not run OntoSight from a subdirectory with bare `.` — auto-init may index the wrong tree.
58
+
59
+ **After launch:** confirm OntoSight terminal output shows the correct **project path** and topology symbols under that project. If mismatch → stop and re-run with corrected absolute path.
60
+
23
61
  ### When to run OntoSight
24
62
 
25
63
  Run (or suggest) OntoSight when the user:
@@ -41,12 +79,13 @@ Do **not** run OntoSight to collect agent context — that duplicates CodeGraph
41
79
 
42
80
  **Workflow** (mandatory order):
43
81
 
44
- 1. `codegraph_search({ query: "<symbol>" })` — confirm name, file, kind
45
- 2. `codegraph_impact({ query: "<symbol>" })` — ranked blast radius (chat facts)
82
+ 0. `codegraph_status({ projectPath: "<workspace-root>" })` — verify index at workspace root
83
+ 1. `codegraph_search({ query: "<symbol>", projectPath: "<workspace-root>" })` — confirm name, file, kind
84
+ 2. `codegraph_impact({ query: "<symbol>", projectPath: "<workspace-root>" })` — ranked blast radius (chat facts)
46
85
  3. Read **`.agents/skills/ui-ux-pro-max/IMPACT-DEMO.md`** — presentation checklist (use your tool's skills path: `.agents/skills/`, `.agents/skills/`, `.agents/skills/`)
47
86
  4. Optional: run ui-ux-pro-max searches from the playbook for chart/UX framing
48
87
  5. Summarize in chat: seed symbol, top impacted callers, risk tier, what the graph will highlight
49
- 6. `npx @royalsolution/ontosight . --symbol <name> --path <dir> --hops 3 --max-nodes 200`
88
+ 6. `npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path <dir> --hops 3 --max-nodes 200`
50
89
 
51
90
  **Hop guidance:** use `--hops 3` (or `4` for deep trees) for impact demos; prefer `--path` over raising `--max-nodes` when truncated.
52
91
 
@@ -56,25 +95,29 @@ Do **not** run OntoSight to collect agent context — that duplicates CodeGraph
56
95
 
57
96
  **Symbol the user named:**
58
97
 
59
- 1. `codegraph_search({ query: "<name>" })` → confirm file + kind
98
+ 0. `codegraph_status({ projectPath: "<workspace-root>" })`
99
+ 1. `codegraph_search({ query: "<name>", projectPath: "<workspace-root>" })` → confirm file + kind
60
100
  2. Summarize in chat
61
- 3. `npx @royalsolution/ontosight . --symbol <name> --path <dir-from-search>`
101
+ 3. `npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path <dir-from-search>`
62
102
 
63
103
  **Feature area ("how does auth work?"):**
64
104
 
65
- 1. `codegraph_context({ task: "authentication flow", maxNodes: 20 })`
105
+ 0. `codegraph_status({ projectPath: "<workspace-root>" })`
106
+ 1. `codegraph_context({ task: "authentication flow", maxNodes: 20, projectPath: "<workspace-root>" })`
66
107
  2. Summarize key symbols in chat
67
- 3. `npx @royalsolution/ontosight . --task "authentication flow" --hops 2 --max-nodes 200`
108
+ 3. `npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --task "authentication flow" --hops 2 --max-nodes 200`
68
109
 
69
110
  **Large repo:** prefer `--path` or `--symbol` before raising `--max-nodes`.
70
111
 
71
112
  ### Commands
72
113
 
114
+ Replace `<workspace-root>` with the absolute path to the open workspace (never bare `.` when root is known):
115
+
73
116
  ```bash
74
- npx @royalsolution/ontosight .
75
- npx @royalsolution/ontosight . --symbol <name> --path <dir>
76
- npx @royalsolution/ontosight . --task "auth flow" --hops 2 --max-nodes 200
77
- npx @royalsolution/ontosight . --symbol <name> --path <dir> --hops 3 --max-nodes 200
117
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>"
118
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path <dir>
119
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --task "auth flow" --hops 2 --max-nodes 200
120
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path <dir> --hops 3 --max-nodes 200
78
121
  ```
79
122
 
80
123
  Auto-creates the CodeGraph index when `.codegraph/codegraph.db` is missing (unless `ONTOSIGHT_SKIP_AUTO_INIT=1`). Ask the user before auto-init on very large repos.
@@ -83,7 +126,7 @@ Auto-creates the CodeGraph index when `.codegraph/codegraph.db` is missing (unle
83
126
 
84
127
  | Requirement | Notes |
85
128
  |-------------|-------|
86
- | Node 20+ | For `npx @royalsolution/ontosight` |
129
+ | Node 20+ | For `npx @royalsolution/ontosight@0.2.0` |
87
130
  | Python 3.11+ | Used by `ontosight-codegraph` |
88
131
  | uv (recommended) or pipx | Wrapper tries `uvx` first, then `pipx run` |
89
- | CodeGraph index | `.codegraph/codegraph.db` in project root |
132
+ | CodeGraph index | `.codegraph/codegraph.db` in workspace root |
@@ -83,12 +83,14 @@ Example — correct:
83
83
  |-------|--------|
84
84
  | `task must be a non-empty string` | Use `task` (not `query`) on `codegraph_context`; use `maxNodes` (not `limit`). For `/resume`, read `.agent/SESSION.md` instead. |
85
85
  | MCP “not initialized” | Run `npx @colbymchenry/codegraph init -i` in project root |
86
+ | MCP wrong project / path mismatch | Pass `projectPath: "<workspace-root>"` on all `codegraph_*` calls; use the same root for OntoSight `[project-path]` |
86
87
  | MCP not connecting | Reload Cursor; verify `.cursor/mcp.json`; test `npx @colbymchenry/codegraph serve --mcp` |
87
88
  | Stale symbols after edit | Wait ~2s for watcher sync, or check staleness banner in tool output |
88
89
  | Init failed during install | Run `npx @colbymchenry/codegraph init -i` manually |
90
+ | OntoSight shows wrong project's graph | Pass absolute workspace root to OntoSight (not bare `.`); run `codegraph_status` first — see [`.cursor/references/ontosight.md`](ontosight.md) |
89
91
 
90
92
  ## Visualization (OntoSight)
91
93
 
92
- For interactive call-graph exploration in the browser, use **[OntoSight](https://www.npmjs.com/package/@royalsolution/ontosight)** (`npx @royalsolution/ontosight`). Gather facts with `codegraph_*` first; open OntoSight when the user wants a visual UI. See [`.cursor/references/ontosight.md`](ontosight.md).
94
+ For interactive call-graph exploration in the browser, use **[OntoSight](https://www.npmjs.com/package/@royalsolution/ontosight)** (`npx @royalsolution/ontosight@0.2.0`). Gather facts with `codegraph_*` first; open OntoSight when the user wants a visual UI. Pass the **absolute workspace root** as `[project-path]` (not bare `.`) so the browser loads this project's graph. See [`.cursor/references/ontosight.md`](ontosight.md).
93
95
 
94
96
  Upstream: [colbymchenry/codegraph](https://github.com/colbymchenry/codegraph)
@@ -2,6 +2,8 @@
2
2
 
3
3
  [OntoSight](https://www.npmjs.com/package/@royalsolution/ontosight) visualizes [CodeGraph](https://github.com/colbymchenry/codegraph) call subgraphs in an interactive browser UI. **class-ai-agent** installs usage rules across all four agent trees; invocation is via `npx` (no npm dependency).
4
4
 
5
+ **Recommended version:** `@royalsolution/ontosight@0.2.0` (pins PyPI `ontosight-codegraph` 0.2.0). Use unpinned `npx @royalsolution/ontosight@0.2.0` only when the user explicitly wants latest.
6
+
5
7
  OntoSight complements CodeGraph MCP — use `codegraph_*` for structural facts in chat; use OntoSight when the user wants visual exploration. See also [`.cursor/references/codegraph.md`](codegraph.md).
6
8
 
7
9
  ## Per-tool wiring
@@ -13,17 +15,32 @@ OntoSight complements CodeGraph MCP — use `codegraph_*` for structural facts i
13
15
  | Kiro | `.kiro/steering/ontosight.md` | `.kiro/references/ontosight.md` |
14
16
  | Antigravity | `.agent/rules/ontosight.md` | `.agents/references/ontosight.md` |
15
17
 
18
+ ## Project graph fidelity
19
+
20
+ OntoSight loads nodes from `.codegraph/codegraph.db` under **`[project-path]`** (default: shell `cwd`). To ensure the browser shows **this workspace's** graph:
21
+
22
+ 1. Resolve workspace root (absolute path).
23
+ 2. Run `codegraph_status({ projectPath: "<workspace-root>" })` before OntoSight.
24
+ 3. Pass **absolute workspace root** as `[project-path]` — never bare `.` when root is known.
25
+ 4. Seed `--symbol` / `--task` from `codegraph_*` queries using the **same** `projectPath`.
26
+ 5. After launch, verify terminal output: printed project path and topology symbols belong to this repo.
27
+
28
+ See **Project graph fidelity** in [`.cursor/rules/ontosight.mdc`](../rules/ontosight.mdc).
29
+
16
30
  ## Quick start
17
31
 
32
+ Replace `<workspace-root>` with the absolute path to the open workspace:
33
+
18
34
  ```bash
19
35
  # Full project — seeds from highest fan-in symbols
20
- npx @royalsolution/ontosight .
36
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>"
21
37
 
22
38
  # Seed around a symbol (optionally scoped to a path)
23
- npx @royalsolution/ontosight . --symbol view_graph --path src/auth/
39
+ # --symbol must exist in this project (confirm via codegraph_search first)
40
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path src/auth/
24
41
 
25
42
  # Task-scoped subgraph (keyword FTS seeding)
26
- npx @royalsolution/ontosight . --task "auth flow" --hops 2 --max-nodes 200
43
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --task "auth flow" --hops 2 --max-nodes 200
27
44
  ```
28
45
 
29
46
  Auto-creates the CodeGraph index when `.codegraph/codegraph.db` is missing (unless `ONTOSIGHT_SKIP_AUTO_INIT=1`).
@@ -32,7 +49,7 @@ Auto-creates the CodeGraph index when `.codegraph/codegraph.db` is missing (unle
32
49
 
33
50
  | Flag | Description | Default |
34
51
  |------|-------------|---------|
35
- | `[project-path]` | Project root containing `.codegraph/` | `.` (cwd) |
52
+ | `[project-path]` | Project root containing `.codegraph/` | `.` (cwd) — **prefer absolute workspace root** |
36
53
  | `--path <dir>` | Limit symbols to files under this path | — |
37
54
  | `--symbol <name>` | Seed symbol for BFS subgraph expansion | auto (fan-in) |
38
55
  | `--task <text>` | Natural-language seed (keyword match) | — |
@@ -46,17 +63,19 @@ Auto-creates the CodeGraph index when `.codegraph/codegraph.db` is missing (unle
46
63
  ### Symbol the user named
47
64
 
48
65
  ```text
49
- 1. codegraph_search({ query: "view_graph" }) → confirm file + kind
66
+ 0. codegraph_status({ projectPath: "<workspace-root>" })
67
+ 1. codegraph_search({ query: "<name>", projectPath: "<workspace-root>" }) → confirm file + kind
50
68
  2. Tell user what you found
51
- 3. npx @royalsolution/ontosight . --symbol view_graph --path <dir-from-search>
69
+ 3. npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path <dir-from-search>
52
70
  ```
53
71
 
54
72
  ### Feature area ("how does auth work?")
55
73
 
56
74
  ```text
57
- 1. codegraph_context({ task: "authentication flow", maxNodes: 20 })
75
+ 0. codegraph_status({ projectPath: "<workspace-root>" })
76
+ 1. codegraph_context({ task: "authentication flow", maxNodes: 20, projectPath: "<workspace-root>" })
58
77
  2. Summarize key symbols in chat
59
- 3. npx @royalsolution/ontosight . --task "authentication flow" --hops 2 --max-nodes 200
78
+ 3. npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --task "authentication flow" --hops 2 --max-nodes 200
60
79
  ```
61
80
 
62
81
  ### Impact analysis demonstration
@@ -68,18 +87,19 @@ When the user wants to **know** or **see** impact (blast radius, what breaks, do
68
87
  **Workflow:**
69
88
 
70
89
  ```text
71
- 1. codegraph_search({ query: "<symbol>" }) → confirm file + kind
72
- 2. codegraph_impact({ query: "<symbol>" }) ranked blast radius
90
+ 0. codegraph_status({ projectPath: "<workspace-root>" })
91
+ 1. codegraph_search({ query: "<symbol>", projectPath: "<workspace-root>" }) confirm file + kind
92
+ 2. codegraph_impact({ query: "<symbol>", projectPath: "<workspace-root>" }) → ranked blast radius
73
93
  3. Read skills/ui-ux-pro-max/IMPACT-DEMO.md → UX presentation checklist
74
94
  4. Optional: ui-ux-pro-max chart/ux searches (see playbook)
75
95
  5. Summarize in chat (seed, ranked table, what graph shows)
76
- 6. npx @royalsolution/ontosight . --symbol <name> --path <dir> --hops 3 --max-nodes 200
96
+ 6. npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path <dir> --hops 3 --max-nodes 200
77
97
  ```
78
98
 
79
- **Example:**
99
+ **Example** (replace paths and symbol with values from `codegraph_search` in **this** project):
80
100
 
81
101
  ```bash
82
- npx @royalsolution/ontosight . --symbol deleteUser --path src/services/ --hops 3 --max-nodes 200
102
+ npx @royalsolution/ontosight@0.2.0 "/path/to/workspace" --symbol deleteUser --path src/services/ --hops 3 --max-nodes 200
83
103
  ```
84
104
 
85
105
  **UX:** Always text summary before opening the browser; include a ranked table of top impacted symbols (accessible alternative to graph-only). See [IMPACT-DEMO.md](../skills/ui-ux-pro-max/IMPACT-DEMO.md).
@@ -89,8 +109,9 @@ npx @royalsolution/ontosight . --symbol deleteUser --path src/services/ --hops 3
89
109
  ### Index missing
90
110
 
91
111
  ```bash
112
+ cd "<workspace-root>"
92
113
  npx @colbymchenry/codegraph init -i
93
- # or let the OntoSight wrapper auto-init (default)
114
+ # or let the OntoSight wrapper auto-init (default) — only when [project-path] is correct
94
115
  ```
95
116
 
96
117
  ## Environment variables
@@ -104,10 +125,10 @@ npx @colbymchenry/codegraph init -i
104
125
 
105
126
  | Requirement | Notes |
106
127
  |-------------|-------|
107
- | Node 20+ | For `npx @royalsolution/ontosight` |
128
+ | Node 20+ | For `npx @royalsolution/ontosight@0.2.0` |
108
129
  | Python 3.11+ | Used by `ontosight-codegraph` |
109
130
  | uv (recommended) or pipx | Wrapper tries `uvx` first, then `pipx run` |
110
- | CodeGraph index | `.codegraph/codegraph.db` in project root |
131
+ | CodeGraph index | `.codegraph/codegraph.db` in workspace root |
111
132
 
112
133
  ## What the user sees
113
134
 
@@ -115,11 +136,16 @@ npx @colbymchenry/codegraph init -i
115
136
  2. OntoSight opens in the browser with the call subgraph, critical-node highlights, and a CodeGraph query panel for live reloads.
116
137
  3. Process stays running until the user closes the server (Ctrl+C in terminal).
117
138
 
139
+ **Verify fidelity:** confirm the printed **project path** matches workspace root and topology symbols are files under that project — not another repo. If mismatch, stop and re-run with the corrected absolute path.
140
+
118
141
  ## Troubleshooting
119
142
 
120
143
  | Issue | Action |
121
144
  |-------|--------|
122
- | `CodeGraph index not found` | Run `npx @colbymchenry/codegraph init -i` or remove `ONTOSIGHT_SKIP_AUTO_INIT` |
145
+ | Browser shows symbols from another repo | Re-run with absolute workspace root as `[project-path]`; delete stray `.codegraph/` in wrong cwd if auto-init ran there |
146
+ | Empty or generic graph | Run `codegraph init -i` in workspace root; seed with `--symbol` from `codegraph_search` in this project |
147
+ | MCP and OntoSight disagree | Align paths: same root for MCP `projectPath` and OntoSight `[project-path]` |
148
+ | `CodeGraph index not found` | Run `npx @colbymchenry/codegraph init -i` in workspace root or remove `ONTOSIGHT_SKIP_AUTO_INIT` |
123
149
  | `Neither uv nor pipx found` | Install uv: `curl -LsSf https://astral.sh/uv/install.sh \| sh` |
124
150
  | Subgraph truncated warning | Add `--symbol`, `--task`, or `--path`; lower scope before raising `--max-nodes` |
125
151
  | Stale symbols after edits | Wait ~2s for CodeGraph watcher sync, or re-run init |
@@ -46,7 +46,7 @@ Use for: summary-before-graph; tell the user what OntoSight is loading and what
46
46
 
47
47
  ## Chat summary template
48
48
 
49
- Present this **before** running `npx @royalsolution/ontosight`:
49
+ Present this **before** running `npx @royalsolution/ontosight@0.2.0` (with absolute workspace root as `[project-path]`):
50
50
 
51
51
  ### 1. Seed
52
52
 
@@ -71,10 +71,10 @@ Group by risk: **direct callers** (highest) vs **transitive** (lower).
71
71
 
72
72
  ### 4. Action
73
73
 
74
- Short line: *"Opening interactive impact graph…"* then run:
74
+ Short line: *"Opening interactive impact graph…"* then run (replace `<workspace-root>` with absolute workspace path):
75
75
 
76
76
  ```bash
77
- npx @royalsolution/ontosight . --symbol <name> --path <dir-from-search> --hops 3 --max-nodes 200
77
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path <dir-from-search> --hops 3 --max-nodes 200
78
78
  ```
79
79
 
80
80
  ---
@@ -90,12 +90,13 @@ npx @royalsolution/ontosight . --symbol <name> --path <dir-from-search> --hops 3
90
90
  ## Full agent workflow
91
91
 
92
92
  ```text
93
- 1. codegraph_search({ query: "<symbol>" })
94
- 2. codegraph_impact({ query: "<symbol>" })
93
+ 0. codegraph_status({ projectPath: "<workspace-root>" }) → verify index at workspace root
94
+ 1. codegraph_search({ query: "<symbol>", projectPath: "<workspace-root>" })
95
+ 2. codegraph_impact({ query: "<symbol>", projectPath: "<workspace-root>" })
95
96
  3. Read this file (IMPACT-DEMO.md)
96
97
  4. Optional: ui-ux-pro-max chart/ux searches above
97
98
  5. Chat summary (template sections 1–3)
98
- 6. npx @royalsolution/ontosight . --symbol <name> --path <dir> --hops 3 --max-nodes 200
99
+ 6. npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path <dir> --hops 3 --max-nodes 200
99
100
  ```
100
101
 
101
102
  See **`.agents/references/ontosight.md`** for flags and troubleshooting.
package/.claude/CLAUDE.md CHANGED
@@ -132,7 +132,7 @@ This project includes **[OntoSight](https://www.npmjs.com/package/@royalsolution
132
132
  | Setup reference | `.claude/references/ontosight.md` |
133
133
  | Shared index | `.codegraph/` (same as CodeGraph) |
134
134
 
135
- Use `codegraph_*` MCP tools to gather structural facts in chat; run `npx @royalsolution/ontosight .` when the user wants a visual call graph. For **impact analysis demos**, follow `skills/ui-ux-pro-max/IMPACT-DEMO.md` (search → `codegraph_impact` → summary → graph). Requires Node 20+, Python 3.11+, and uv or pipx.
135
+ Use `codegraph_*` MCP tools to gather structural facts in chat; run `npx @royalsolution/ontosight@0.2.0 .` when the user wants a visual call graph. For **impact analysis demos**, follow `skills/ui-ux-pro-max/IMPACT-DEMO.md` (search → `codegraph_impact` → summary → graph). Requires Node 20+, Python 3.11+, and uv or pipx.
136
136
 
137
137
  ---
138
138
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  [OntoSight](https://www.npmjs.com/package/@royalsolution/ontosight) visualizes [CodeGraph](https://github.com/colbymchenry/codegraph) call subgraphs in an interactive browser UI. **class-ai-agent** installs usage rules across all four agent trees; invocation is via `npx` (no npm dependency).
4
4
 
5
+ **Recommended version:** `@royalsolution/ontosight@0.2.0` (pins PyPI `ontosight-codegraph` 0.2.0). Use unpinned `npx @royalsolution/ontosight@0.2.0` only when the user explicitly wants latest.
6
+
5
7
  OntoSight complements CodeGraph MCP — use `codegraph_*` for structural facts in chat; use OntoSight when the user wants visual exploration. See also [`.cursor/references/codegraph.md`](codegraph.md).
6
8
 
7
9
  ## Per-tool wiring
@@ -13,17 +15,32 @@ OntoSight complements CodeGraph MCP — use `codegraph_*` for structural facts i
13
15
  | Kiro | `.kiro/steering/ontosight.md` | `.kiro/references/ontosight.md` |
14
16
  | Antigravity | `.agent/rules/ontosight.md` | `.agents/references/ontosight.md` |
15
17
 
18
+ ## Project graph fidelity
19
+
20
+ OntoSight loads nodes from `.codegraph/codegraph.db` under **`[project-path]`** (default: shell `cwd`). To ensure the browser shows **this workspace's** graph:
21
+
22
+ 1. Resolve workspace root (absolute path).
23
+ 2. Run `codegraph_status({ projectPath: "<workspace-root>" })` before OntoSight.
24
+ 3. Pass **absolute workspace root** as `[project-path]` — never bare `.` when root is known.
25
+ 4. Seed `--symbol` / `--task` from `codegraph_*` queries using the **same** `projectPath`.
26
+ 5. After launch, verify terminal output: printed project path and topology symbols belong to this repo.
27
+
28
+ See **Project graph fidelity** in [`.cursor/rules/ontosight.mdc`](../rules/ontosight.mdc).
29
+
16
30
  ## Quick start
17
31
 
32
+ Replace `<workspace-root>` with the absolute path to the open workspace:
33
+
18
34
  ```bash
19
35
  # Full project — seeds from highest fan-in symbols
20
- npx @royalsolution/ontosight .
36
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>"
21
37
 
22
38
  # Seed around a symbol (optionally scoped to a path)
23
- npx @royalsolution/ontosight . --symbol view_graph --path src/auth/
39
+ # --symbol must exist in this project (confirm via codegraph_search first)
40
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path src/auth/
24
41
 
25
42
  # Task-scoped subgraph (keyword FTS seeding)
26
- npx @royalsolution/ontosight . --task "auth flow" --hops 2 --max-nodes 200
43
+ npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --task "auth flow" --hops 2 --max-nodes 200
27
44
  ```
28
45
 
29
46
  Auto-creates the CodeGraph index when `.codegraph/codegraph.db` is missing (unless `ONTOSIGHT_SKIP_AUTO_INIT=1`).
@@ -32,7 +49,7 @@ Auto-creates the CodeGraph index when `.codegraph/codegraph.db` is missing (unle
32
49
 
33
50
  | Flag | Description | Default |
34
51
  |------|-------------|---------|
35
- | `[project-path]` | Project root containing `.codegraph/` | `.` (cwd) |
52
+ | `[project-path]` | Project root containing `.codegraph/` | `.` (cwd) — **prefer absolute workspace root** |
36
53
  | `--path <dir>` | Limit symbols to files under this path | — |
37
54
  | `--symbol <name>` | Seed symbol for BFS subgraph expansion | auto (fan-in) |
38
55
  | `--task <text>` | Natural-language seed (keyword match) | — |
@@ -46,17 +63,19 @@ Auto-creates the CodeGraph index when `.codegraph/codegraph.db` is missing (unle
46
63
  ### Symbol the user named
47
64
 
48
65
  ```text
49
- 1. codegraph_search({ query: "view_graph" }) → confirm file + kind
66
+ 0. codegraph_status({ projectPath: "<workspace-root>" })
67
+ 1. codegraph_search({ query: "<name>", projectPath: "<workspace-root>" }) → confirm file + kind
50
68
  2. Tell user what you found
51
- 3. npx @royalsolution/ontosight . --symbol view_graph --path <dir-from-search>
69
+ 3. npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path <dir-from-search>
52
70
  ```
53
71
 
54
72
  ### Feature area ("how does auth work?")
55
73
 
56
74
  ```text
57
- 1. codegraph_context({ task: "authentication flow", maxNodes: 20 })
75
+ 0. codegraph_status({ projectPath: "<workspace-root>" })
76
+ 1. codegraph_context({ task: "authentication flow", maxNodes: 20, projectPath: "<workspace-root>" })
58
77
  2. Summarize key symbols in chat
59
- 3. npx @royalsolution/ontosight . --task "authentication flow" --hops 2 --max-nodes 200
78
+ 3. npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --task "authentication flow" --hops 2 --max-nodes 200
60
79
  ```
61
80
 
62
81
  ### Impact analysis demonstration
@@ -68,18 +87,19 @@ When the user wants to **know** or **see** impact (blast radius, what breaks, do
68
87
  **Workflow:**
69
88
 
70
89
  ```text
71
- 1. codegraph_search({ query: "<symbol>" }) → confirm file + kind
72
- 2. codegraph_impact({ query: "<symbol>" }) ranked blast radius
90
+ 0. codegraph_status({ projectPath: "<workspace-root>" })
91
+ 1. codegraph_search({ query: "<symbol>", projectPath: "<workspace-root>" }) confirm file + kind
92
+ 2. codegraph_impact({ query: "<symbol>", projectPath: "<workspace-root>" }) → ranked blast radius
73
93
  3. Read skills/ui-ux-pro-max/IMPACT-DEMO.md → UX presentation checklist
74
94
  4. Optional: ui-ux-pro-max chart/ux searches (see playbook)
75
95
  5. Summarize in chat (seed, ranked table, what graph shows)
76
- 6. npx @royalsolution/ontosight . --symbol <name> --path <dir> --hops 3 --max-nodes 200
96
+ 6. npx @royalsolution/ontosight@0.2.0 "<workspace-root>" --symbol <name> --path <dir> --hops 3 --max-nodes 200
77
97
  ```
78
98
 
79
- **Example:**
99
+ **Example** (replace paths and symbol with values from `codegraph_search` in **this** project):
80
100
 
81
101
  ```bash
82
- npx @royalsolution/ontosight . --symbol deleteUser --path src/services/ --hops 3 --max-nodes 200
102
+ npx @royalsolution/ontosight@0.2.0 "/path/to/workspace" --symbol deleteUser --path src/services/ --hops 3 --max-nodes 200
83
103
  ```
84
104
 
85
105
  **UX:** Always text summary before opening the browser; include a ranked table of top impacted symbols (accessible alternative to graph-only). See [IMPACT-DEMO.md](../skills/ui-ux-pro-max/IMPACT-DEMO.md).
@@ -89,8 +109,9 @@ npx @royalsolution/ontosight . --symbol deleteUser --path src/services/ --hops 3
89
109
  ### Index missing
90
110
 
91
111
  ```bash
112
+ cd "<workspace-root>"
92
113
  npx @colbymchenry/codegraph init -i
93
- # or let the OntoSight wrapper auto-init (default)
114
+ # or let the OntoSight wrapper auto-init (default) — only when [project-path] is correct
94
115
  ```
95
116
 
96
117
  ## Environment variables
@@ -104,10 +125,10 @@ npx @colbymchenry/codegraph init -i
104
125
 
105
126
  | Requirement | Notes |
106
127
  |-------------|-------|
107
- | Node 20+ | For `npx @royalsolution/ontosight` |
128
+ | Node 20+ | For `npx @royalsolution/ontosight@0.2.0` |
108
129
  | Python 3.11+ | Used by `ontosight-codegraph` |
109
130
  | uv (recommended) or pipx | Wrapper tries `uvx` first, then `pipx run` |
110
- | CodeGraph index | `.codegraph/codegraph.db` in project root |
131
+ | CodeGraph index | `.codegraph/codegraph.db` in workspace root |
111
132
 
112
133
  ## What the user sees
113
134
 
@@ -115,11 +136,16 @@ npx @colbymchenry/codegraph init -i
115
136
  2. OntoSight opens in the browser with the call subgraph, critical-node highlights, and a CodeGraph query panel for live reloads.
116
137
  3. Process stays running until the user closes the server (Ctrl+C in terminal).
117
138
 
139
+ **Verify fidelity:** confirm the printed **project path** matches workspace root and topology symbols are files under that project — not another repo. If mismatch, stop and re-run with the corrected absolute path.
140
+
118
141
  ## Troubleshooting
119
142
 
120
143
  | Issue | Action |
121
144
  |-------|--------|
122
- | `CodeGraph index not found` | Run `npx @colbymchenry/codegraph init -i` or remove `ONTOSIGHT_SKIP_AUTO_INIT` |
145
+ | Browser shows symbols from another repo | Re-run with absolute workspace root as `[project-path]`; delete stray `.codegraph/` in wrong cwd if auto-init ran there |
146
+ | Empty or generic graph | Run `codegraph init -i` in workspace root; seed with `--symbol` from `codegraph_search` in this project |
147
+ | MCP and OntoSight disagree | Align paths: same root for MCP `projectPath` and OntoSight `[project-path]` |
148
+ | `CodeGraph index not found` | Run `npx @colbymchenry/codegraph init -i` in workspace root or remove `ONTOSIGHT_SKIP_AUTO_INIT` |
123
149
  | `Neither uv nor pipx found` | Install uv: `curl -LsSf https://astral.sh/uv/install.sh \| sh` |
124
150
  | Subgraph truncated warning | Add `--symbol`, `--task`, or `--path`; lower scope before raising `--max-nodes` |
125
151
  | Stale symbols after edits | Wait ~2s for CodeGraph watcher sync, or re-run init |
@@ -19,7 +19,7 @@ Use codegraph for **structural** questions — what calls what, what would break
19
19
  | "See several related symbols' source at once" | `codegraph_explore` |
20
20
  | "What files exist under path/" | `codegraph_files` |
21
21
  | "Is the index healthy?" | `codegraph_status` |
22
- | Visual exploration of a subgraph in browser | `npx @royalsolution/ontosight` (see **`.claude/rules/ontosight.md`**) |
22
+ | Visual exploration of a subgraph in browser | `npx @royalsolution/ontosight@0.2.0` (see **`.claude/rules/ontosight.md`**) |
23
23
  | "Show/demonstrate impact of changing Z" | `codegraph_impact` → then OntoSight `--symbol Z` (see **`.claude/rules/ontosight.md`**) |
24
24
 
25
25
  ### Visualization
@@ -28,6 +28,8 @@ For interactive call-graph UI (user asks to "show the graph" or explore architec
28
28
 
29
29
  For **impact demonstration** requests ("show impact", "blast radius", "what breaks if I change X"), run `codegraph_impact` first, present a text summary, then open OntoSight — never stop at MCP text alone when the user wants to see or show impact.
30
30
 
31
+ **Project graph fidelity:** OntoSight is a separate CLI — MCP `${workspaceFolder}` binding does not apply automatically. Pass the **same workspace root** to OntoSight's `[project-path]` as you use for `projectPath` on `codegraph_*` calls when MCP cwd detection is wrong. Run `codegraph_status` before opening OntoSight; seeds (`--symbol`, `--task`) must come from queries against that same index. See **Project graph fidelity** in **`.claude/rules/ontosight.md`**.
32
+
31
33
  ### Tool parameters (do not mix)
32
34
 
33
35
  | Tool | Required arg | Optional cap | Wrong args → error |