From b1162c961dfd498451e1b7d2ff4c7e9f9fcda092 Mon Sep 17 00:00:00 2001 From: mforce <> Date: Sun, 3 May 2026 21:22:41 -0700 Subject: [PATCH] feat: add graphify agent discovery so agents use the knowledge graph on clone - Create AGENTS.md as single source of truth for graphify instructions - Update CLAUDE.md to reference AGENTS.md instead of duplicating - Generate wiki (graphify-out/wiki/) for structured codebase navigation - Add .claude/settings.json with PreToolUse hook for search commands - Add git hooks (.hooks/) for auto-rebuild on commit/checkout - Update .gitignore to ignore graphify-out/cache/ - Commit graph outputs (graph.json, GRAPH_REPORT.md, graph.html, wiki/) --- .claude/settings.json | 21 + .gitignore | 2 +- .hooks/post-checkout | 69 + .hooks/post-commit | 69 + AGENTS.md | 23 + CLAUDE.md | 3 + ...6-05-03-graphify-agent-discovery-design.md | 54 + graphify-out/GRAPH_REPORT.md | 177 +- graphify-out/graph.html | 10 +- graphify-out/graph.json | 3976 ++++++----------- graphify-out/wiki/Arg_Splitting.md | 28 + graphify-out/wiki/CLI_Entry_&_Flags.md | 47 + graphify-out/wiki/CLI_Help.md | 25 + graphify-out/wiki/CLI_Integration_Tests.md | 26 + graphify-out/wiki/Compat_Layer.md | 34 + graphify-out/wiki/Config_Tests.md | 27 + graphify-out/wiki/INCOMPATIBILITIES_table.md | 23 + graphify-out/wiki/ListerKind_type.md | 19 + graphify-out/wiki/Lister_Tests.md | 45 + graphify-out/wiki/Mock_Fetch.md | 25 + graphify-out/wiki/Model_Entry_Type.md | 25 + graphify-out/wiki/Module_Imports.md | 49 + graphify-out/wiki/PROVIDERS_registry.md | 20 + graphify-out/wiki/Provider_Dispatch.md | 40 + graphify-out/wiki/Restore_Fetch.md | 25 + graphify-out/wiki/Resume_Session.md | 33 + graphify-out/wiki/Runner_Type.md | 25 + graphify-out/wiki/Setup_&_Config.md | 40 + graphify-out/wiki/Split_Result_Type.md | 25 + graphify-out/wiki/Version_Reporting.md | 30 + graphify-out/wiki/index.md | 46 + graphify-out/wiki/listForProvider().md | 22 + graphify-out/wiki/listLmStudio().md | 29 + graphify-out/wiki/listOllama().md | 29 + graphify-out/wiki/listV1Models().md | 25 + graphify-out/wiki/main().md | 28 + graphify-out/wiki/main()_2.md | 22 + graphify-out/wiki/runSetup().md | 20 + 38 files changed, 2532 insertions(+), 2704 deletions(-) create mode 100644 .claude/settings.json create mode 100755 .hooks/post-checkout create mode 100755 .hooks/post-commit create mode 100644 AGENTS.md create mode 100644 CLAUDE.md create mode 100644 docs/superpowers/specs/2026-05-03-graphify-agent-discovery-design.md create mode 100644 graphify-out/wiki/Arg_Splitting.md create mode 100644 graphify-out/wiki/CLI_Entry_&_Flags.md create mode 100644 graphify-out/wiki/CLI_Help.md create mode 100644 graphify-out/wiki/CLI_Integration_Tests.md create mode 100644 graphify-out/wiki/Compat_Layer.md create mode 100644 graphify-out/wiki/Config_Tests.md create mode 100644 graphify-out/wiki/INCOMPATIBILITIES_table.md create mode 100644 graphify-out/wiki/ListerKind_type.md create mode 100644 graphify-out/wiki/Lister_Tests.md create mode 100644 graphify-out/wiki/Mock_Fetch.md create mode 100644 graphify-out/wiki/Model_Entry_Type.md create mode 100644 graphify-out/wiki/Module_Imports.md create mode 100644 graphify-out/wiki/PROVIDERS_registry.md create mode 100644 graphify-out/wiki/Provider_Dispatch.md create mode 100644 graphify-out/wiki/Restore_Fetch.md create mode 100644 graphify-out/wiki/Resume_Session.md create mode 100644 graphify-out/wiki/Runner_Type.md create mode 100644 graphify-out/wiki/Setup_&_Config.md create mode 100644 graphify-out/wiki/Split_Result_Type.md create mode 100644 graphify-out/wiki/Version_Reporting.md create mode 100644 graphify-out/wiki/index.md create mode 100644 graphify-out/wiki/listForProvider().md create mode 100644 graphify-out/wiki/listLmStudio().md create mode 100644 graphify-out/wiki/listOllama().md create mode 100644 graphify-out/wiki/listV1Models().md create mode 100644 graphify-out/wiki/main().md create mode 100644 graphify-out/wiki/main()_2.md create mode 100644 graphify-out/wiki/runSetup().md diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..6c01c3f --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,21 @@ +{ + "permissions": { + "allow": [ + "Bash(dart run *)" + ] + }, + "defaultMode": "auto", + "hooks": { + "PreToolUse": [ + { + "matcher": "Bash", + "hooks": [ + { + "type": "command", + "command": "CMD=$(python3 -c \"import json,sys; d=json.load(sys.stdin); print(d.get('tool_input',d).get('command',''))\" 2>/dev/null || true); case \"$CMD\" in *grep*|*rg\\ *|*ripgrep*|*find\\ *|*fd\\ *|*ack\\ *|*ag\\ *) [ -f graphify-out/graph.json ] && echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"additionalContext\":\"graphify: Knowledge graph exists. Read graphify-out/GRAPH_REPORT.md for god nodes and community structure before searching raw files.\"}}' || true ;; esac" + } + ] + } + ] + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 027dc36..1871445 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ dist-test/ #graphify graphify-out/manifest.json # mtime-based, breaks after git clone graphify-out/cost.json # local only -# graphify-out/cache/ # optional: commit for speed, skip to keep repo small \ No newline at end of file +graphify-out/cache/ \ No newline at end of file diff --git a/.hooks/post-checkout b/.hooks/post-checkout new file mode 100755 index 0000000..086f397 --- /dev/null +++ b/.hooks/post-checkout @@ -0,0 +1,69 @@ +#!/bin/sh +# graphify-checkout-hook-start +# Auto-rebuilds the knowledge graph (code only) when switching branches. +# Installed by: graphify hook install + +PREV_HEAD=$1 +NEW_HEAD=$2 +BRANCH_SWITCH=$3 + +# Only run on branch switches, not file checkouts +if [ "$BRANCH_SWITCH" != "1" ]; then + exit 0 +fi + +# Only run if graphify-out/ exists (graph has been built before) +if [ ! -d "graphify-out" ]; then + exit 0 +fi + +# Skip during rebase/merge/cherry-pick +GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) +[ -d "$GIT_DIR/rebase-merge" ] && exit 0 +[ -d "$GIT_DIR/rebase-apply" ] && exit 0 +[ -f "$GIT_DIR/MERGE_HEAD" ] && exit 0 +[ -f "$GIT_DIR/CHERRY_PICK_HEAD" ] && exit 0 + +# Detect the correct Python interpreter (handles pipx, venv, system installs) +GRAPHIFY_BIN=$(command -v graphify 2>/dev/null) +if [ -n "$GRAPHIFY_BIN" ]; then + case "$GRAPHIFY_BIN" in + *.exe) _SHEBANG="" ;; + *) _SHEBANG=$(head -1 "$GRAPHIFY_BIN" | sed 's/^#![[:space:]]*//') ;; + esac + case "$_SHEBANG" in + */env\ *) GRAPHIFY_PYTHON="${_SHEBANG#*/env }" ;; + *) GRAPHIFY_PYTHON="$_SHEBANG" ;; + esac + # Allowlist: only keep characters valid in a filesystem path to prevent + # injection if the shebang contains shell metacharacters + case "$GRAPHIFY_PYTHON" in + *[!a-zA-Z0-9/_.@-]*) GRAPHIFY_PYTHON="" ;; + esac + if [ -n "$GRAPHIFY_PYTHON" ] && ! "$GRAPHIFY_PYTHON" -c "import graphify" 2>/dev/null; then + GRAPHIFY_PYTHON="" + fi +fi +# Fall back: try python3, then python (Windows has no python3 shim) +if [ -z "$GRAPHIFY_PYTHON" ]; then + if command -v python3 >/dev/null 2>&1 && python3 -c "import graphify" 2>/dev/null; then + GRAPHIFY_PYTHON="python3" + elif command -v python >/dev/null 2>&1 && python -c "import graphify" 2>/dev/null; then + GRAPHIFY_PYTHON="python" + else + exit 0 + fi +fi + +echo "[graphify] Branch switched - rebuilding knowledge graph (code files)..." +$GRAPHIFY_PYTHON -c " +from graphify.watch import _rebuild_code +from pathlib import Path +import sys +try: + _rebuild_code(Path('.')) +except Exception as exc: + print(f'[graphify] Rebuild failed: {exc}') + sys.exit(1) +" +# graphify-checkout-hook-end diff --git a/.hooks/post-commit b/.hooks/post-commit new file mode 100755 index 0000000..c87ccec --- /dev/null +++ b/.hooks/post-commit @@ -0,0 +1,69 @@ +#!/bin/sh +# graphify-hook-start +# Auto-rebuilds the knowledge graph after each commit (code files only, no LLM needed). +# Installed by: graphify hook install + +# Skip during rebase/merge/cherry-pick to avoid blocking --continue with unstaged changes +GIT_DIR=$(git rev-parse --git-dir 2>/dev/null) +[ -d "$GIT_DIR/rebase-merge" ] && exit 0 +[ -d "$GIT_DIR/rebase-apply" ] && exit 0 +[ -f "$GIT_DIR/MERGE_HEAD" ] && exit 0 +[ -f "$GIT_DIR/CHERRY_PICK_HEAD" ] && exit 0 + +CHANGED=$(git diff --name-only HEAD~1 HEAD 2>/dev/null || git diff --name-only HEAD 2>/dev/null) +if [ -z "$CHANGED" ]; then + exit 0 +fi + +# Detect the correct Python interpreter (handles pipx, venv, system installs) +GRAPHIFY_BIN=$(command -v graphify 2>/dev/null) +if [ -n "$GRAPHIFY_BIN" ]; then + case "$GRAPHIFY_BIN" in + *.exe) _SHEBANG="" ;; + *) _SHEBANG=$(head -1 "$GRAPHIFY_BIN" | sed 's/^#![[:space:]]*//') ;; + esac + case "$_SHEBANG" in + */env\ *) GRAPHIFY_PYTHON="${_SHEBANG#*/env }" ;; + *) GRAPHIFY_PYTHON="$_SHEBANG" ;; + esac + # Allowlist: only keep characters valid in a filesystem path to prevent + # injection if the shebang contains shell metacharacters + case "$GRAPHIFY_PYTHON" in + *[!a-zA-Z0-9/_.@-]*) GRAPHIFY_PYTHON="" ;; + esac + if [ -n "$GRAPHIFY_PYTHON" ] && ! "$GRAPHIFY_PYTHON" -c "import graphify" 2>/dev/null; then + GRAPHIFY_PYTHON="" + fi +fi +# Fall back: try python3, then python (Windows has no python3 shim) +if [ -z "$GRAPHIFY_PYTHON" ]; then + if command -v python3 >/dev/null 2>&1 && python3 -c "import graphify" 2>/dev/null; then + GRAPHIFY_PYTHON="python3" + elif command -v python >/dev/null 2>&1 && python -c "import graphify" 2>/dev/null; then + GRAPHIFY_PYTHON="python" + else + exit 0 + fi +fi + +export GRAPHIFY_CHANGED="$CHANGED" +$GRAPHIFY_PYTHON -c " +import os, sys +from pathlib import Path + +changed_raw = os.environ.get('GRAPHIFY_CHANGED', '') +changed = [Path(f.strip()) for f in changed_raw.strip().splitlines() if f.strip()] + +if not changed: + sys.exit(0) + +print(f'[graphify hook] {len(changed)} file(s) changed - rebuilding graph...') + +try: + from graphify.watch import _rebuild_code + _rebuild_code(Path('.')) +except Exception as exc: + print(f'[graphify hook] Rebuild failed: {exc}') + sys.exit(1) +" +# graphify-hook-end diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..a1c0cff --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,23 @@ +## graphify — Knowledge Graph + +This project has a pre-built knowledge graph at `graphify-out/`. Use it to understand architecture before reading source files. + +### Before exploring the codebase + +Read `graphify-out/GRAPH_REPORT.md` for god nodes, community structure, and surprising connections. If `graphify-out/wiki/index.md` exists, navigate the wiki instead of reading raw source files — each article covers one architectural community with its nodes, edges, and relationships. + +### Instead of grep for architecture questions + +Use graph queries instead of scanning files: + +```bash +graphify query "how does config connect to providers?" +graphify path "ConfigModule" "ProviderRegistry" +graphify explain "main()" +``` + +These traverse EXTRACTED + INFERRED edges in the knowledge graph rather than doing text search. + +### After modifying code + +Run `graphify --update` to keep the graph current. This is AST-only for code changes — no API cost. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..3573617 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,3 @@ +## graphify + +See AGENTS.md for knowledge graph instructions. diff --git a/docs/superpowers/specs/2026-05-03-graphify-agent-discovery-design.md b/docs/superpowers/specs/2026-05-03-graphify-agent-discovery-design.md new file mode 100644 index 0000000..9d1e731 --- /dev/null +++ b/docs/superpowers/specs/2026-05-03-graphify-agent-discovery-design.md @@ -0,0 +1,54 @@ +# Graphify Agent Discovery Integration + +**Date:** 2026-05-03 +**Status:** Approved + +## Goal + +Make the graphify knowledge graph discoverable by any coding agent (Claude Code, Copilot CLI, Cursor) immediately on clone, so agents read the pre-built graph instead of scanning raw source files — saving tokens and improving architecture awareness. + +## Decisions + +- **Agent scope:** Claude Code + cross-agent via AGENTS.md (Copilot CLI, Cursor). No per-agent files (GEMINI.md, .cursorrules) for now. +- **Hook scope:** Keep current search-only PreToolUse hook (grep/rg/find/fd/ack/ag). No interception of file reads. +- **Commit strategy:** Commit all graphify outputs (graph.json, GRAPH_REPORT.md, graph.html, wiki/) so the graph is available on clone. +- **Instruction consolidation:** AGENTS.md is the single source of truth for graphify instructions. CLAUDE.md references it instead of duplicating. + +## Changes + +### 1. Create `AGENTS.md` + +New root file read by all agents. Contains: +- Instruction to read `graphify-out/GRAPH_REPORT.md` before exploring the codebase +- Instruction to navigate `graphify-out/wiki/index.md` instead of reading raw source files +- Available query commands: `graphify query`, `graphify path`, `graphify explain` +- Instruction to run `graphify --update` after code changes + +### 2. Update `CLAUDE.md` + +Replace the `## graphify` section (written by `graphify claude install`) with a one-liner referencing AGENTS.md. The PreToolUse hook remains in `.claude/settings.json` — it's Claude Code infrastructure, not agent instructions. + +### 3. Generate wiki + +Run the graphify wiki pipeline to produce `graphify-out/wiki/` with `index.md` + one article per community. The CLAUDE.md rule "if wiki/index.md exists, navigate it instead of reading raw files" becomes active once this exists. + +### 4. Update `.gitignore` + +Uncomment `graphify-out/cache/` to actively ignore it. Keep ignoring `manifest.json` (mtime-based, breaks after clone) and `cost.json` (local tracking). Everything else in `graphify-out/` is committed. + +### 5. Commit all outputs + +Single commit containing: +- `AGENTS.md` (new) +- `CLAUDE.md` (updated) +- `.claude/settings.json` (already exists, unchanged) +- `.hooks/post-commit`, `.hooks/post-checkout` (already exist) +- `graphify-out/graph.json`, `graphify-out/GRAPH_REPORT.md`, `graphify-out/graph.html` +- `graphify-out/wiki/` (new) + +## What's NOT changing + +- PreToolUse hook in `.claude/settings.json` — already correct, search-only +- Git hooks in `.hooks/` — already installed and working +- No new source code in claudely itself +- No GEMINI.md or .cursorrules files diff --git a/graphify-out/GRAPH_REPORT.md b/graphify-out/GRAPH_REPORT.md index 960463c..536025c 100644 --- a/graphify-out/GRAPH_REPORT.md +++ b/graphify-out/GRAPH_REPORT.md @@ -1,149 +1,130 @@ # Graph Report - /home/cesar/dev/claudely (2026-05-03) ## Corpus Check -- Corpus is ~14,888 words - fits in a single context window. You may not need a graph. +- 18 files · ~7,723 words +- Verdict: corpus is large enough that graph structure adds value. ## Summary -- 165 nodes · 210 edges · 15 communities detected -- Extraction: 79% EXTRACTED · 21% INFERRED · 0% AMBIGUOUS · INFERRED: 44 edges (avg confidence: 0.83) +- 119 nodes · 155 edges · 12 communities detected +- Extraction: 87% EXTRACTED · 13% INFERRED · 0% AMBIGUOUS · INFERRED: 20 edges (avg confidence: 0.86) - Token cost: 0 input · 0 output ## Community Hubs (Navigation) -- [[_COMMUNITY_CLI Core & Config|CLI Core & Config]] -- [[_COMMUNITY_Compiled Output (dist-test)|Compiled Output (dist-test)]] -- [[_COMMUNITY_Setup Wizard Spec|Setup Wizard Spec]] -- [[_COMMUNITY_Source Modules & Tests|Source Modules & Tests]] -- [[_COMMUNITY_Lister Integration Tests|Lister Integration Tests]] -- [[_COMMUNITY_Provider & Model Discovery|Provider & Model Discovery]] -- [[_COMMUNITY_Test Helpers & Mocking|Test Helpers & Mocking]] -- [[_COMMUNITY_Session Resume Logic|Session Resume Logic]] -- [[_COMMUNITY_CLI-Lister Bridge|CLI-Lister Bridge]] -- [[_COMMUNITY_Compatibility Layer|Compatibility Layer]] -- [[_COMMUNITY_Version Tests (dist)|Version Tests (dist)]] -- [[_COMMUNITY_Help Text|Help Text]] -- [[_COMMUNITY_ModelEntry Type|ModelEntry Type]] +- [[_COMMUNITY_Setup & Config|Setup & Config]] +- [[_COMMUNITY_CLI Entry & Flags|CLI Entry & Flags]] +- [[_COMMUNITY_Lister Tests|Lister Tests]] +- [[_COMMUNITY_Module Imports|Module Imports]] +- [[_COMMUNITY_Provider Dispatch|Provider Dispatch]] +- [[_COMMUNITY_Resume Session|Resume Session]] +- [[_COMMUNITY_Compat Layer|Compat Layer]] +- [[_COMMUNITY_Version Reporting|Version Reporting]] +- [[_COMMUNITY_CLI Help|CLI Help]] +- [[_COMMUNITY_Model Entry Type|Model Entry Type]] - [[_COMMUNITY_Runner Type|Runner Type]] -- [[_COMMUNITY_RestoreFetch Helper|RestoreFetch Helper]] +- [[_COMMUNITY_Split Result Type|Split Result Type]] ## God Nodes (most connected - your core abstractions) -1. `main()` - 21 edges -2. `main()` - 10 edges -3. `main()` - 10 edges -4. `PROVIDERS registry` - 8 edges -5. `listLmStudio()` - 6 edges -6. `listOllama()` - 6 edges -7. `listV1Models()` - 6 edges -8. `claudely setup -- Interactive Configuration Wizard` - 6 edges -9. `listForProvider()` - 5 edges -10. `listV1Models()` - 5 edges +1. `main()` - 11 edges +2. `main()` - 7 edges +3. `listLmStudio()` - 6 edges +4. `listOllama()` - 6 edges +5. `listV1Models()` - 6 edges +6. `listForProvider()` - 5 edges +7. `PROVIDERS registry` - 5 edges +8. `runSetup()` - 5 edges +9. `ListerKind type` - 4 edges +10. `INCOMPATIBILITIES table` - 4 edges ## Surprising Connections (you probably didn't know these) -- `src/config.ts -- Config persistence layer` --semantically_similar_to--> `Compatibility layer (applyCompat, loadSettings, INCOMPATIBILITIES)` [INFERRED] [semantically similar] - docs/superpowers/specs/2026-05-03-setup-wizard-design.md → dist-test/compat.js -- `Setting resolution precedence chain` --semantically_similar_to--> `Auto-resume on bare invocation feature` [INFERRED] [semantically similar] - docs/superpowers/specs/2026-05-03-setup-wizard-design.md → dist-test/cli.js -- `main()` --implemented_by--> `KV-cache speedup via CLAUDE_CODE_ATTRIBUTION_HEADER=0` [EXTRACTED] - src/cli.ts → README.md -- `main()` --implemented_by--> `Setting resolution precedence chain` [INFERRED] - src/cli.ts → docs/superpowers/specs/2026-05-03-setup-wizard-design.md -- `PROVIDERS registry` --reads--> `src/setup.ts -- Interactive wizard (runSetup)` [EXTRACTED] - src/providers.ts → docs/superpowers/specs/2026-05-03-setup-wizard-design.md - -## Hyperedges (group relationships) -- **config.ts consolidates all config I/O functions** — setup_config_ts, setup_load_config, setup_save_config, setup_config_dir, setup_config_path, setup_load_settings [INFERRED 1.00] -- **Platform-native config file locations resolved by configDir()** — setup_config_file_linux, setup_config_file_macos, setup_config_file_windows [INFERRED 1.00] -- **loadSettings decoupling: moved from compat.ts to config.ts, cli.ts import updated** — setup_cli_ts, setup_compat_ts, setup_config_ts [INFERRED 1.00] +- `applyCompat()` --calls--> `main()` [INFERRED] + compat.ts → cli.ts +- `main()` --calls--> `loadSettings()` [INFERRED] + cli.ts → config.ts +- `main()` --calls--> `loadConfig()` [INFERRED] + cli.ts → config.ts +- `main()` --calls--> `runSetup()` [INFERRED] + cli.ts → setup.ts +- `loadConfig()` --calls--> `runSetup()` [INFERRED] + config.ts → setup.ts ## Communities -### Community 0 - "CLI Core & Config" -Cohesion: 0.08 -Nodes (27): FlagSpec interface, Argument splitter (splitArgs), splitArgs(), Auto-resume on bare invocation feature, FLAG_SPEC, main(), Compatibility layer (applyCompat, loadSettings, INCOMPATIBILITIES), Arg splitting pattern (own vs claude passthrough) (+19 more) - -### Community 1 - "Compiled Output (dist-test)" -Cohesion: 0.18 -Nodes (14): splitArgs(), main(), applyCompat(), loadSettings(), assembleClaudeArgv(), encodeCwdForClaude(), hasRecentSessionForCwd(), isResumeIntent() (+6 more) - -### Community 2 - "Setup Wizard Spec" +### Community 0 - "Setup & Config" Cohesion: 0.14 Nodes (20): ClaudelyConfig, src/cli.ts, src/compat.ts, configDir(), Linux config path, macOS config path, Windows config path, configPath() (+12 more) -### Community 3 - "Source Modules & Tests" -Cohesion: 0.15 -Nodes (3): probeClaudeVersion(), readClaudelyVersion(), renderVersion() +### Community 1 - "CLI Entry & Flags" +Cohesion: 0.12 +Nodes (13): FlagSpec interface, splitArgs(), FLAG_SPEC, main(), applyCompat(), INCOMPATIBILITIES table, Incompatibility interface, Arg splitting pattern (own vs claude passthrough) (+5 more) -### Community 4 - "Lister Integration Tests" -Cohesion: 0.16 -Nodes (3): listLmStudio(), listOllama(), listV1Models() +### Community 2 - "Lister Tests" +Cohesion: 0.15 +Nodes (6): installFake(), prependToPath(), readArgvLog(), listLmStudio(), listOllama(), listV1Models() -### Community 5 - "Provider & Model Discovery" -Cohesion: 0.23 -Nodes (15): listForProvider(), Auth env-style pattern (auth_token vs api_key), Lister fallback pattern (CLI tool -> /v1/models HTTP), Provider env-style auth (auth_token vs api_key), listLmStudio(), listOllama(), listV1Models(), custom provider (+7 more) +### Community 3 - "Module Imports" +Cohesion: 0.26 +Nodes (9): listForProvider(), main(), configDir(), configPath(), loadConfig(), loadSettings(), saveConfig(), listForProvider() (+1 more) -### Community 6 - "Test Helpers & Mocking" -Cohesion: 0.22 -Nodes (3): mockV1Fallback(), mockFetch(), mockV1Fallback() +### Community 4 - "Provider Dispatch" +Cohesion: 0.25 +Nodes (14): listForProvider(), Auth env-style pattern (auth_token vs api_key), Lister fallback pattern (CLI tool -> /v1/models HTTP), listLmStudio(), listOllama(), listV1Models(), custom provider, EnvStyle type (+6 more) -### Community 7 - "Session Resume Logic" +### Community 5 - "Resume Session" Cohesion: 0.32 -Nodes (5): encodeCwdForClaude(), hasRecentSessionForCwd(), isResumeIntent(), shouldAutoResume(), seedSessionFile() +Nodes (4): encodeCwdForClaude(), hasRecentSessionForCwd(), isResumeIntent(), shouldAutoResume() -### Community 8 - "CLI-Lister Bridge" -Cohesion: 0.57 -Nodes (5): listForProvider(), listLmStudio(), listOllama(), listV1Models(), listForProvider() +### Community 6 - "Compat Layer" +Cohesion: 0.33 +Nodes (2): applyCompat(), isAnthropicHost() -### Community 9 - "Compatibility Layer" -Cohesion: 0.5 -Nodes (4): applyCompat(), INCOMPATIBILITIES table, Incompatibility interface, Settings incompatibility clamping pattern +### Community 7 - "Version Reporting" +Cohesion: 0.6 +Nodes (3): probeClaudeVersion(), readClaudelyVersion(), renderVersion() -### Community 17 - "Version Tests (dist)" +### Community 11 - "CLI Help" Cohesion: 1.0 Nodes (1): HELP text -### Community 18 - "Help Text" +### Community 12 - "Model Entry Type" Cohesion: 1.0 Nodes (1): ModelEntry interface -### Community 19 - "ModelEntry Type" +### Community 13 - "Runner Type" Cohesion: 1.0 Nodes (1): Runner type -### Community 20 - "Runner Type" +### Community 14 - "Split Result Type" Cohesion: 1.0 Nodes (1): SplitResult interface -### Community 23 - "RestoreFetch Helper" -Cohesion: 1.0 -Nodes (1): claudely - launch Claude Code against local LLM - ## Knowledge Gaps -- **18 isolated node(s):** `HELP text`, `ModelEntry interface`, `Runner type`, `Incompatibility interface`, `FlagSpec interface` (+13 more) +- **8 isolated node(s):** `HELP text`, `ModelEntry interface`, `Runner type`, `Incompatibility interface`, `FlagSpec interface` (+3 more) These have ≤1 connection - possible missing edges or undocumented components. -- **Thin community `Version Tests (dist)`** (1 nodes): `HELP text` +- **Thin community `Compat Layer`** (7 nodes): `compat.test.ts`, `compat.ts`, `applyCompat()`, `isAnthropicHost()`, `loadSettings()`, `compat.test.ts`, `compat.ts` Too small to be a meaningful cluster - may be noise or needs more connections extracted. -- **Thin community `Help Text`** (1 nodes): `ModelEntry interface` +- **Thin community `CLI Help`** (1 nodes): `HELP text` Too small to be a meaningful cluster - may be noise or needs more connections extracted. -- **Thin community `ModelEntry Type`** (1 nodes): `Runner type` +- **Thin community `Model Entry Type`** (1 nodes): `ModelEntry interface` Too small to be a meaningful cluster - may be noise or needs more connections extracted. -- **Thin community `Runner Type`** (1 nodes): `SplitResult interface` +- **Thin community `Runner Type`** (1 nodes): `Runner type` Too small to be a meaningful cluster - may be noise or needs more connections extracted. -- **Thin community `RestoreFetch Helper`** (1 nodes): `claudely - launch Claude Code against local LLM` +- **Thin community `Split Result Type`** (1 nodes): `SplitResult interface` Too small to be a meaningful cluster - may be noise or needs more connections extracted. ## Suggested Questions _Questions this graph is uniquely positioned to answer:_ -- **Why does `main()` connect `CLI Core & Config` to `Compatibility Layer`, `Provider & Model Discovery`?** - _High betweenness centrality (0.078) - this node is a cross-community bridge._ -- **Why does `main()` connect `Compiled Output (dist-test)` to `CLI-Lister Bridge`, `Source Modules & Tests`?** - _High betweenness centrality (0.075) - this node is a cross-community bridge._ -- **Why does `mockV1Fallback()` connect `Test Helpers & Mocking` to `Lister Integration Tests`?** - _High betweenness centrality (0.039) - this node is a cross-community bridge._ -- **Are the 8 inferred relationships involving `main()` (e.g. with `splitArgs()` and `renderVersion()`) actually correct?** - _`main()` has 8 INFERRED edges - model-reasoned connections that need verification._ -- **Are the 8 inferred relationships involving `main()` (e.g. with `splitArgs()` and `loadSettings()`) actually correct?** - _`main()` has 8 INFERRED edges - model-reasoned connections that need verification._ +- **Why does `main()` connect `Module Imports` to `Compat Layer`?** + _High betweenness centrality (0.074) - this node is a cross-community bridge._ +- **Why does `main()` connect `CLI Entry & Flags` to `Provider Dispatch`?** + _High betweenness centrality (0.057) - this node is a cross-community bridge._ +- **Why does `listForProvider()` connect `Provider Dispatch` to `CLI Entry & Flags`?** + _High betweenness centrality (0.024) - this node is a cross-community bridge._ +- **Are the 4 inferred relationships involving `main()` (e.g. with `applyCompat()` and `loadConfig()`) actually correct?** + _`main()` has 4 INFERRED edges - model-reasoned connections that need verification._ +- **Are the 4 inferred relationships involving `listLmStudio()` (e.g. with `ListerKind type` and `lmstudio provider`) actually correct?** + _`listLmStudio()` has 4 INFERRED edges - model-reasoned connections that need verification._ +- **Are the 4 inferred relationships involving `listOllama()` (e.g. with `ListerKind type` and `ollama provider`) actually correct?** + _`listOllama()` has 4 INFERRED edges - model-reasoned connections that need verification._ - **What connects `HELP text`, `ModelEntry interface`, `Runner type` to the rest of the system?** - _18 weakly-connected nodes found - possible documentation gaps or missing edges._ -- **Should `CLI Core & Config` be split into smaller, more focused modules?** - _Cohesion score 0.08 - nodes in this community are weakly interconnected._ \ No newline at end of file + _8 weakly-connected nodes found - possible documentation gaps or missing edges._ \ No newline at end of file diff --git a/graphify-out/graph.html b/graphify-out/graph.html index 9fbe2de..32c43ef 100644 --- a/graphify-out/graph.html +++ b/graphify-out/graph.html @@ -57,12 +57,12 @@

Communities

-
165 nodes · 210 edges · 24 communities
+
119 nodes · 155 edges · 17 communities