code-graph-llm
Advanced tools
+21
-6
@@ -239,9 +239,24 @@ #!/usr/bin/env node | ||
| formatOutput() { | ||
| const header = `# CODE_GRAPH_MAP\n> MISSION: COMPACT PROJECT MAP FOR LLM AGENTS.\n> PROTOCOL: Follow llm-agent-rules.md | MEMORY: See llm-agent-project-learnings.md\n> Legend: [CORE] Entry Point, (βN) Outgoing Deps, (βM) Incoming Dependents\n> Notation: syms: [Name [Signature/Context]], desc: File Summary, [TAG: Context]\n\n`; | ||
| const header = `# CODE_GRAPH\n> Protocol: llm-agent-rules.md | Lessons: llm-agent-project-learnings.md\n> Legend: * core, (βout βin deps), s: symbols, d: desc\n\n`; | ||
| const nodes = this.files.map(f => { | ||
| const inCount = this.incomingEdges[f.path] || 0; | ||
| const tags = f.tags.length ? ` [${f.tags.join(', ')}]` : ''; | ||
| return `- ${f.isCore ? '[CORE] ' : ''}${f.path} (β${f.outCount} β${inCount})${tags} | desc: ${f.desc.substring(0, 100)}\n - syms: [${f.symbols.join(', ')}]`; | ||
| const tags = f.tags.length ? ` [${f.tags.join(',')}]` : ''; | ||
| return `- ${f.isCore ? '*' : ''}${f.path} (${f.outCount}β ${inCount}β)${tags} | d: ${f.desc.substring(0, 80)}\n - s: [${f.symbols.join(', ')}]`; | ||
| }).join('\n'); | ||
| const edges = this.allEdges.length ? `\n\n## GRAPH EDGES\n${Array.from(new Set(this.allEdges)).sort().join('\n')}` : ''; | ||
| // Group edges by source for density | ||
| const groupedEdges = {}; | ||
| this.allEdges.forEach(e => { | ||
| const match = e.match(/\[(.*?)\] -> \[imports\] -> \[(.*?)\]/); | ||
| if (match) { | ||
| const [_, src, target] = match; | ||
| if (!groupedEdges[src]) groupedEdges[src] = new Set(); | ||
| groupedEdges[src].add(target); | ||
| } | ||
| }); | ||
| const edges = Object.keys(groupedEdges).length | ||
| ? `\n\n## EDGES\n${Object.entries(groupedEdges).map(([src, targets]) => `[${src}] -> [${Array.from(targets).join(', ')}]`).sort().join('\n')}` | ||
| : ''; | ||
| return header + nodes + edges; | ||
@@ -259,4 +274,4 @@ } | ||
| const filePath = path.join(process.cwd(), CONFIG.REFLECTIONS_FILE); | ||
| const header = `# LLM_AGENT_PROJECT_LEARNINGS\n> LLM AGENT MEMORY: READ BEFORE STARTING TASKS. UPDATE ON FAILURES.\n`; | ||
| const entry = `- [${category.toUpperCase()}: ${new Date().toISOString().split('T')[0]}] ${lesson}`; | ||
| const header = `# LLM_LEARNINGS\n> READ BEFORE TASKS. UPDATE ON FAILURES.\n`; | ||
| const entry = `- [${category.toUpperCase()}] ${lesson}`; | ||
@@ -263,0 +278,0 @@ try { |
@@ -19,2 +19,3 @@ # LLM_AGENT_PROJECT_LEARNINGS | ||
| - [TOOLING: 2026-04-16] Upgraded to v3.2.1: Exhaustive documentation of platform-specific installation details and integration table synchronization. | ||
| - [TOOLING: 2026-04-16] Upgraded to v3.3.0: "Active Agent Orchestration" release. Added `install-agent` for explicit delegation, unified `install` commands, and automated `preuninstall` cleanup logic. | ||
| - [TOOLING: 2026-04-16] Upgraded to v3.3.0: "Active Agent Orchestration" release. Added `install-agent` for explicit delegation, unified `install` commands, and automated `preuninstall` cleanup logic. | ||
| - [TOOLING: 2026-04-16] Upgraded to v3.4.0: "Hyper-Condensed Context" release. Minified project map and reflection outputs (30-50% token reduction). Implemented edge grouping and metadata stripping. Refactored defensive uninstallation for 15+ platforms. |
+10
-27
@@ -1,29 +0,12 @@ | ||
| # CODE_GRAPH_MAP | ||
| > MISSION: COMPACT PROJECT MAP FOR LLM AGENTS. | ||
| > PROTOCOL: Follow llm-agent-rules.md | MEMORY: See llm-agent-project-learnings.md | ||
| > Legend: [CORE] Entry Point, (βN) Outgoing Deps, (βM) Incoming Dependents | ||
| > Notation: syms: [Name [Signature/Context]], desc: File Summary, [TAG: Context] | ||
| # CODE_GRAPH | ||
| > Protocol: llm-agent-rules.md | Lessons: llm-agent-project-learnings.md | ||
| > Legend: * core, (βout βin deps), s: symbols, d: desc | ||
| - [CORE] index.js (β7 β1) [TODO: |FIXME|BUG|DEPRECATED):?\s*(.*)/i,, bug: s or complex regex pitfalls., bug: s or version deprecations., bug: fix or failure.\n`;, bug: ,"] | desc: !usrbinenv node | ||
| - syms: [AgentManager [Manages sub-agent registrations and orchestrator integrations.], CONFIG [=], CodeParser [--- Core Services --- Handles extraction of symbols, edges, and metadata from source code.], ProjectInitializer [Scaffolds the initial agent-agnostic rule and reflection files.], ProjectMapper [Manages the project mapping and file generation.], ReflectionManager [Manages project reflections and lessons learned.], SUPPORTED_EXTENSIONS [: [], SkillManager [Manages platform-specific skills and agent integrations.], add [(context ? `${display} [${context}]` : display)], appendToFile [('CLAUDE.md', section)], execute [(platform, action, skill)], extract [(content)], init [(cwd)], install [-skills <platform> [projectmap|reflections]')], installAntigravityAgent [()], installGeminiAgent [()], installGenericPersona [()], installGitHook [(cwd)], installGlobalSkill [('gemini', 'projectmap', skillContent)], installKiroAgent [()], installMCPServer [()], installProjectMap [(p)], installReflections [(p)], main [|app|server|cli)\./i.test(path.basename(relPath))], processFile [(fullPath, relPath)], removeFile [('.cursor/rules/projectmap.mdc')], uninstall [-skills') await this.uninstall(p, s)], walk [(dir, ig)], writeFile [(path.join(this.cwd, CONFIG.MAP_FILE)], writeJson [('.claude/settings.json', { hooks: { preToolUse: [{ tools: ['glob', 'grep'], message: `Skill(ProjectMap)]] | ||
| - [CORE] test/index.test.js (β10 β0) | desc: | ||
| - syms: [] | ||
| - *index.js (7β 1β) [TODO: |FIXME|BUG|DEPRECATED):?\s*(.*)/i,,bug: s or complex regex pitfalls.,bug: s or version deprecations.,bug: fix or failure.\n`;,bug: ,"] | d: !usrbinenv node | ||
| - s: [AgentManager [Manages sub-agent registrations and orchestrator integrations.], CONFIG [=], CodeParser [--- Core Services --- Handles extraction of symbols, edges, and metadata from source code.], ProjectInitializer [Scaffolds the initial agent-agnostic rule and reflection files.], ProjectMapper [Manages the project mapping and file generation.], ReflectionManager [Manages project reflections and lessons learned.], SUPPORTED_EXTENSIONS [: [], SkillManager [Manages platform-specific skills and agent integrations.], add [(context ? `${display} [${context}]` : display)], appendToFile [('CLAUDE.md', section)], execute [(platform, action, skill)], extract [(content)], init [(cwd)], install [-skills <platform> [projectmap|reflections]')], installAntigravityAgent [()], installGeminiAgent [()], installGenericPersona [()], installGitHook [(cwd)], installGlobalSkill [('gemini', 'projectmap', skillContent)], installKiroAgent [()], installMCPServer [()], installProjectMap [(p)], installReflections [(p)], main [|app|server|cli)\./i.test(path.basename(relPath))], processFile [(fullPath, relPath)], removeFile [('.cursor/rules/projectmap.mdc')], uninstall [-skills') await this.uninstall(p, s)], walk [(dir, ig)], writeFile [(path.join(this.cwd, CONFIG.MAP_FILE)], writeJson [('.claude/settings.json', { hooks: { preToolUse: [{ tools: ['glob', 'grep'], message: `Skill(ProjectMap)]] | ||
| - *test/index.test.js (10β 0β) | d: | ||
| - s: [] | ||
| ## GRAPH EDGES | ||
| [index.js] -> [imports] -> [chokidar] | ||
| [index.js] -> [imports] -> [fs] | ||
| [index.js] -> [imports] -> [ignore] | ||
| [index.js] -> [imports] -> [os] | ||
| [index.js] -> [imports] -> [path] | ||
| [index.js] -> [imports] -> [symbols] | ||
| [index.js] -> [imports] -> [url] | ||
| [test/index.test.js] -> [imports] -> [assert] | ||
| [test/index.test.js] -> [imports] -> [fs] | ||
| [test/index.test.js] -> [imports] -> [header.h] | ||
| [test/index.test.js] -> [imports] -> [index.js] | ||
| [test/index.test.js] -> [imports] -> [node] | ||
| [test/index.test.js] -> [imports] -> [other-module] | ||
| [test/index.test.js] -> [imports] -> [path] | ||
| [test/index.test.js] -> [imports] -> [test/local-file] | ||
| [test/index.test.js] -> [imports] -> [test] | ||
| [test/index.test.js] -> [imports] -> [url] | ||
| ## EDGES | ||
| [index.js] -> [chokidar, fs, ignore, os, path, symbols, url] | ||
| [test/index.test.js] -> [index.js, test/local-file, assert, fs, header.h, node, other-module, path, test, url] |
+1
-1
| { | ||
| "name": "code-graph-llm", | ||
| "version": "3.3.0", | ||
| "version": "3.4.0", | ||
| "description": "Compact, language-agnostic codebase mapper for LLM token efficiency.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+18
-12
@@ -1,10 +0,10 @@ | ||
| # CODE-GRAPH (v3.3.0) | ||
| # CODE-GRAPH (v3.4.0) | ||
| A language-agnostic, ultra-compact codebase mapper and **agent memory system** designed specifically for LLM agents. It optimizes context and token usage while enabling agents to learn from their own mistakes across sessions. | ||
| ## π New in v3.3: Active Agent Orchestration | ||
| - **Active Sub-Agents:** Register `code-graph` as a specialized sub-agent for Gemini, Claude, and more. | ||
| - **Unified Setup:** New `install` and `uninstall` commands for effortless full-system configuration. | ||
| - **MCP Tool Support:** Expose mapping and reflection tools via Model Context Protocol (Claude/Cursor). | ||
| - **Automated Cleanup:** Smart `preuninstall` hook removes all global and local data upon NPM uninstall. | ||
| ## π New in v3.4: Hyper-Condensed Context | ||
| - **Token Minification:** Condensed `llm-code-graph.md` output by 30-50% using minified notation. | ||
| - **Grouped Edges:** Consolidated dependency mapping (`[src] -> [target1, target2]`) for extreme density. | ||
| - **Metadata Stripping:** Removed redundant timestamps from reflections to save context window. | ||
| - **Robust Uninstall:** Defensive file and directory cleanup for all 15+ supported platforms. | ||
@@ -139,12 +139,18 @@ ## π οΈ The Code-Graph Architecture | ||
| ### 2. The "Read First" Strategy | ||
| The `llm-code-graph.md` file provides a high-level map and structural graph for relational reasoning: | ||
| The `llm-code-graph.md` file provides a high-level map and structural graph for relational reasoning. It is minified for maximum token efficiency. | ||
| **Notation Legend:** | ||
| * `*` : Core Entry Point (God Node). | ||
| * `(βout βin)` : Dependency counts (Outgoing β / Incoming β). | ||
| * `s:` : Symbols (Classes, Functions, Types). | ||
| * `d:` : Description (Contextual Summary). | ||
| **Example Map Entry:** | ||
| ```markdown | ||
| - [CORE] src/auth.js (β3 β5) [TODO: Add JWT rotation] | desc: Handles user authentication. | ||
| - syms: [login [ (username, password) ], validateToken [ (token: string) ]] | ||
| - *src/auth.js (3β 5β) [TODO:Add JWT rotation] | d: Handles user authentication. | ||
| - s: [login [ (username, password) ], validateToken [ (token: string) ]] | ||
| ## GRAPH EDGES | ||
| [src/auth.js] -> [imports] -> [jwt-library] | ||
| [AdminUser] -> [inherits] -> [BaseUser] | ||
| ## EDGES | ||
| [src/auth.js] -> [jwt-lib, db-connector] | ||
| [AdminUser] -> [BaseUser] | ||
| ``` | ||
@@ -151,0 +157,0 @@ |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
795
1.4%225
2.74%54538
-0.11%