Skip to content

Commit 3b8d9ff

Browse files
committed
chore: add graphify knowledge graph and opencode config
1 parent 7b6540f commit 3b8d9ff

11 files changed

Lines changed: 8456 additions & 0 deletions

File tree

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
graphify-out/graph.json merge=graphify

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ build/
2222
.vscode/
2323
*.swp
2424
*.swo
25+
26+
graphify-out/cost.json
27+
graphify-out/cache/
28+
29+
# OpenCode
30+
.opencode/node_modules/

.opencode/opencode.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://opencode.ai/config.json",
3+
"plugin": [
4+
".opencode/plugins/graphify.js"
5+
]
6+
}

.opencode/plugins/graphify.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// graphify OpenCode plugin
2+
// Injects a knowledge graph reminder before bash tool calls when the graph exists.
3+
//
4+
// IMPORTANT: keep the reminder string free of backticks and $(...) constructs.
5+
// The hook prepends `echo "<reminder>" && <cmd>` to the user's bash command;
6+
// backticks inside the double-quoted echo trigger bash command substitution,
7+
// which both corrupts tool output and silently executes the very graphify
8+
// command we are only suggesting. Plain words render fine in opencode's TUI.
9+
import { existsSync } from "fs";
10+
import { join } from "path";
11+
12+
export const GraphifyPlugin = async ({ directory }) => {
13+
let reminded = false;
14+
15+
return {
16+
"tool.execute.before": async (input, output) => {
17+
if (reminded) return;
18+
if (!existsSync(join(directory, "graphify-out", "graph.json"))) return;
19+
20+
if (input.tool === "bash") {
21+
// ';' not '&&' — Windows PowerShell 5.1 rejects '&&' as a statement
22+
// separator, breaking the first bash command of the session (#1646).
23+
output.args.command =
24+
'echo "[graphify] knowledge graph at graphify-out/. For focused questions, run graphify query with your question (scoped subgraph, usually much smaller than GRAPH_REPORT.md) instead of grepping raw files. Read GRAPH_REPORT.md only for broad architecture context." ; ' +
25+
output.args.command;
26+
reminded = true;
27+
}
28+
},
29+
};
30+
};

graphify-out/.graphify_labels.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"0": "Frontend Linting", "1": "Backend Agent Core", "2": "Agent SQL Generation", "3": "Frontend UI Components", "4": "Frontend TypeScript Config", "5": "Architecture Design Docs", "6": "Backend API Routes", "7": "Frontend Dependencies", "8": "DevOps & CI/CD", "9": "Backend Config Tests", "10": "Backend Exception Tests", "11": "Brand & Visual Identity", "12": "API Integration Tests", "13": "Multi-Agent Workflow", "14": "OpenCode Configuration", "15": "Graphify Plugin", "16": "Backend API Init", "17": "API v1 Init", "18": "Backend Models Init", "19": "Backend Src Init", "20": "Backend Tests Init", "21": "Test API Init", "22": "Test Core Init", "23": "Backend Utils Init", "24": "ESLint Config", "25": "Test Setup", "26": "Vite Env Types", "27": "Vite Config", "28": "Vitest Config", "29": "Package Config"}

graphify-out/.graphify_python

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/arnab/.local/share/uv/tools/graphifyy/bin/python

graphify-out/.graphify_root

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/home/arnab/code/personalCode/CaliperLens

graphify-out/GRAPH_REPORT.md

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# Graph Report - . (2026-08-03)
2+
3+
## Corpus Check
4+
- 52 files · ~153,643 words
5+
- Verdict: corpus is large enough that graph structure adds value.
6+
7+
## Summary
8+
- 293 nodes · 398 edges · 30 communities (28 shown, 2 thin omitted)
9+
- Extraction: 95% EXTRACTED · 5% INFERRED · 0% AMBIGUOUS · INFERRED: 19 edges (avg confidence: 0.66)
10+
- Token cost: 0 input · 0 output
11+
12+
## Community Hubs (Navigation)
13+
- Frontend Linting
14+
- Backend Agent Core
15+
- Agent SQL Generation
16+
- Frontend UI Components
17+
- Frontend TypeScript Config
18+
- Architecture Design Docs
19+
- Backend API Routes
20+
- Frontend Dependencies
21+
- DevOps & CI/CD
22+
- Backend Config Tests
23+
- Backend Exception Tests
24+
- Brand & Visual Identity
25+
- API Integration Tests
26+
- Multi-Agent Workflow
27+
- OpenCode Configuration
28+
- Graphify Plugin
29+
- Package Config
30+
31+
## God Nodes (most connected - your core abstractions)
32+
1. `SQLAgentGenerator` - 21 edges
33+
2. `compilerOptions` - 19 edges
34+
3. `CustomException` - 14 edges
35+
4. `SchemaRAG` - 11 edges
36+
5. `LangGraph Agent` - 11 edges
37+
6. `SchemaGraph` - 10 edges
38+
7. `Settings` - 10 edges
39+
8. `CaliperLens` - 10 edges
40+
9. `scripts` - 9 edges
41+
10. `ChatRequest` - 8 edges
42+
43+
## Surprising Connections (you probably didn't know these)
44+
- `SQL Guardrails` --semantically_similar_to--> `Sandbox Security Properties` [INFERRED] [semantically similar]
45+
README.md → docs/design.md
46+
- `LangSmith Tracing` --conceptually_related_to--> `LangGraph Agent` [EXTRACTED]
47+
docs/design.md → README.md
48+
- `Root Makefile` --rationale_for--> `CaliperLens` [EXTRACTED]
49+
AGENTS.md → README.md
50+
- `TDD Development Philosophy` --rationale_for--> `CaliperLens` [EXTRACTED]
51+
AGENTS.md → README.md
52+
- `NL-to-SQL Eval Harness` --conceptually_related_to--> `CaliperLens` [EXTRACTED]
53+
docs/design.md → README.md
54+
55+
## Import Cycles
56+
- None detected.
57+
58+
## Hyperedges (group relationships)
59+
- **Agent Runtime Stack** — readme_langgraph_agent, readme_gemini_35_flash, readme_faiss_vector_store, readme_networkx_schemagraph, readme_duckdb_analytics, docs_design_sandbox [INFERRED 0.85]
60+
- **Data Pipeline: MySQL to Analytics Marts** — docs_design_dbt_pipeline, docs_design_dbt_duckdb_adapter, docs_design_airflow, readme_duckdb_analytics, docs_design_tiered_query_strategy [INFERRED 0.95]
61+
- **Multi-Agent Build Subagents** — agents_md_multi_agent_workflow, agents_md_builder_subagent, agents_md_playwright_tester, agents_md_ponytail_reviewer [EXTRACTED 1.00]
62+
63+
## Communities (30 total, 2 thin omitted)
64+
65+
### Community 0 - "Frontend Linting"
66+
Cohesion: 0.05
67+
Nodes (37): eslint, eslint-plugin-react-hooks, eslint-plugin-react-refresh, devDependencies, eslint, eslint-plugin-react-hooks, eslint-plugin-react-refresh, jsdom (+29 more)
68+
69+
### Community 1 - "Backend Agent Core"
70+
Cohesion: 0.10
71+
Nodes (19): lifespan(), get_db_tools(), SQLDatabase, Returns a list of custom tools bound to the specific database instance.…, SQLDatabase, Manages a graph representation of the database schema to facilitate pathfinding…, Initialize the SchemaGraph with a database connection and build the graph.…, Constructs the internal NetworkX graph. This method performs two main actions:… (+11 more)
72+
73+
### Community 2 - "Agent SQL Generation"
74+
Cohesion: 0.11
75+
Nodes (12): SQLDatabase, LangGraph-based SQL Agent using Google Gemini 3.5 Flash., SQLAgentGenerator, answer_validation_prompt_module(), generate_query_prompt_module(), query_verification_prompt_module(), Generates the system prompt for the query verification phase (Code Reviewer).…, Generates the system prompt for the table selection/discovery phase. Focuses on… (+4 more)
76+
77+
### Community 3 - "Frontend UI Components"
78+
Cohesion: 0.15
79+
Nodes (16): App(), ChatInput(), ChatInputProps, ChatInterface(), ChatMessage(), ChatMessageProps, checkHealth(), sendMessage() (+8 more)
80+
81+
### Community 4 - "Frontend TypeScript Config"
82+
Cohesion: 0.08
83+
Nodes (24): compilerOptions, allowImportingTsExtensions, esModuleInterop, forceConsistentCasingInFileNames, isolatedModules, jsx, lib, module (+16 more)
84+
85+
### Community 5 - "Architecture Design Docs"
86+
Cohesion: 0.11
87+
Nodes (23): Apache Airflow Orchestration, dbt-duckdb Adapter, dbt Data Pipeline, DuckDB over MySQL Decision, Multi-turn Memory with LangGraph MemorySaver, Phase 2: AWS to Gemini Migration, LangGraph Planner Node, RAG as Deterministic Preprocessing (+15 more)
88+
89+
### Community 6 - "Backend API Routes"
90+
Cohesion: 0.19
91+
Nodes (14): chat_endpoint(), get_agent(), health_check(), ChatRequest, ChatResponse, HealthResponse, Schema for the AI response., Schema for health check response. (+6 more)
92+
93+
### Community 7 - "Frontend Dependencies"
94+
Cohesion: 0.10
95+
Nodes (20): dependencies, react, react-dom, zustand, name, private, scripts, build (+12 more)
96+
97+
### Community 8 - "DevOps & CI/CD"
98+
Cohesion: 0.13
99+
Nodes (18): Root Makefile, TDD Development Philosophy, NL-to-SQL Eval Harness, GitHub Actions CI Pipeline, HIPAA-Compliant Local-Only Backend, JWT Authentication, LangSmith Tracing, Prometheus + Grafana Observability (+10 more)
100+
101+
### Community 9 - "Backend Config Tests"
102+
Cohesion: 0.29
103+
Nodes (4): TestSettings, Central management for settings and configurations., Settings, BaseSettings
104+
105+
### Community 10 - "Backend Exception Tests"
106+
Cohesion: 0.33
107+
Nodes (3): TestCustomException, CustomException, Exception
108+
109+
### Community 11 - "Brand & Visual Identity"
110+
Cohesion: 0.39
111+
Nodes (9): Blue Color Scheme, Healthcare Database Icon, Gear/Processing Icon, Heart Plus Icon, CaliperLens Logo, Magnifying Glass Icon, Natural Language Query Text, To SQL Text (+1 more)
112+
113+
### Community 12 - "API Integration Tests"
114+
Cohesion: 0.40
115+
Nodes (3): TestChatEndpoint, TestHealthEndpoint, skipif
116+
117+
### Community 13 - "Multi-Agent Workflow"
118+
Cohesion: 0.50
119+
Nodes (4): Builder Subagent, Multi-Agent Build Workflow, Playwright Tester Subagent, Ponytail Reviewer Subagent
120+
121+
### Community 14 - "OpenCode Configuration"
122+
Cohesion: 0.50
123+
Nodes (3): plugin, $schema, .opencode/plugins/graphify.js
124+
125+
## Knowledge Gaps
126+
- **74 isolated node(s):** `$schema`, `.opencode/plugins/graphify.js`, `caliperlens`, `name`, `version` (+69 more)
127+
These have ≤1 connection - possible missing edges or undocumented components.
128+
- **2 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
129+
130+
## Suggested Questions
131+
_Questions this graph is uniquely positioned to answer:_
132+
133+
- **Why does `SQLAgentGenerator` connect `Agent SQL Generation` to `Backend Agent Core`, `Backend Exception Tests`?**
134+
_High betweenness centrality (0.049) - this node is a cross-community bridge._
135+
- **Why does `devDependencies` connect `Frontend Linting` to `Frontend Dependencies`?**
136+
_High betweenness centrality (0.032) - this node is a cross-community bridge._
137+
- **Why does `SchemaRAG` connect `Backend Agent Core` to `Agent SQL Generation`?**
138+
_High betweenness centrality (0.024) - this node is a cross-community bridge._
139+
- **Are the 3 inferred relationships involving `SQLAgentGenerator` (e.g. with `SchemaGraph` and `SchemaRAG`) actually correct?**
140+
_`SQLAgentGenerator` has 3 INFERRED edges - model-reasoned connections that need verification._
141+
- **Are the 2 inferred relationships involving `CustomException` (e.g. with `SQLAgentGenerator` and `TestCustomException`) actually correct?**
142+
_`CustomException` has 2 INFERRED edges - model-reasoned connections that need verification._
143+
- **What connects `$schema`, `.opencode/plugins/graphify.js`, `caliperlens` to the rest of the system?**
144+
_74 weakly-connected nodes found - possible documentation gaps or missing edges._
145+
- **Should `Frontend Linting` be split into smaller, more focused modules?**
146+
_Cohesion score 0.05405405405405406 - nodes in this community are weakly interconnected._

graphify-out/graph.html

Lines changed: 320 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)