{"_id":"@astrivya/akg-core","_rev":"6-84797721057f3300c5c11f4374e1c505","name":"@astrivya/akg-core","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"@astrivya/akg-core","version":"0.1.0","keywords":["knowledge-graph","sqlite","fts5","graph-traversal","impact-analysis","astrivya"],"license":"Apache-2.0","_id":"@astrivya/akg-core@0.1.0","maintainers":[{"name":"amruth_jakku","email":"amruthjakku@gmail.com"}],"homepage":"https://github.com/astrivya/astrivya/tree/main/packages/akg-core#readme","bugs":{"url":"https://github.com/astrivya/astrivya/issues"},"dist":{"shasum":"3eb67563d79550c9ccd6cb131ad6e822e5a928f3","tarball":"https://registry.npmjs.org/@astrivya/akg-core/-/akg-core-0.1.0.tgz","fileCount":5,"integrity":"sha512-WxdXq0pOO2F/5DPYPJSAW53oqxlbbGTSV/Vh8kRJkboq9dN5VFK2WdJeWvtaUs4GQR0b/sG78xTyWXd6U4AcEA==","signatures":[{"sig":"MEYCIQCgY6cRAIAdC6pHGo7lIYgCRm8wZSzdcfgxmLyFbfrkQgIhAKUo7A01BEXwI/nC91wNafLNXX5+WTRRNIRe5o9LypWn","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":186085},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"a0d4043a0fa06ff9e547fd8581aea3354d4f4474","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit --project tsconfig.json","test:watch":"vitest","prepublishOnly":"npm run typecheck && npm run build"},"_npmUser":{"name":"amruth_jakku","email":"amruthjakku@gmail.com"},"repository":{"url":"git+https://github.com/astrivya/astrivya.git","type":"git","directory":"packages/akg-core"},"_npmVersion":"11.6.2","description":"Astrivya Knowledge Graph engine — SQLite-embedded, FTS5, vector embeddings, graph traversal, impact analysis, 3-way merge sync","directories":{},"_nodeVersion":"24.13.0","dependencies":{"sql.js":"^1.14.1","env-paths":"^2.2.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.8","typescript":"^5.0.0","@types/node":"^20.19.43","@types/sql.js":"^1.4.11"},"peerDependencies":{"typescript":"^5.0.0"},"peerDependenciesMeta":{"typescript":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/akg-core_0.1.0_1786184856920_0.6874349140089546","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@astrivya/akg-core","version":"0.1.1","keywords":["knowledge-graph","sqlite","fts5","graph-traversal","impact-analysis","astrivya"],"license":"Apache-2.0","_id":"@astrivya/akg-core@0.1.1","maintainers":[{"name":"amruth_jakku","email":"amruthjakku@gmail.com"}],"homepage":"https://github.com/astrivya/astrivya/tree/main/packages/akg-core#readme","bugs":{"url":"https://github.com/astrivya/astrivya/issues"},"dist":{"shasum":"7d37e35433f977e8be5b7180db8565b7012fdb27","tarball":"https://registry.npmjs.org/@astrivya/akg-core/-/akg-core-0.1.1.tgz","fileCount":5,"integrity":"sha512-oVRvEgMZ9g3+X7oxZ8EvnhmsEzFwZm8hbaR920C1cRClPBeeFSqanQhFUJKiXDpkJawB7DxF8WSplUUJ80S6Bg==","signatures":[{"sig":"MEYCIQDWWXgeGEP0ivm9zcszz0YFBSiKFsMBL83JO91vWtksjgIhANFfoxLjn+HrsJdaC0hKOpkHTCb0ZzVkeEVB/r9KZHtE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":186055},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"a0d4043a0fa06ff9e547fd8581aea3354d4f4474","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit --project tsconfig.json","test:watch":"vitest","prepublishOnly":"npm run typecheck && npm run build"},"_npmUser":{"name":"amruth_jakku","email":"amruthjakku@gmail.com"},"repository":{"url":"git+https://github.com/astrivya/astrivya.git","type":"git","directory":"packages/akg-core"},"_npmVersion":"11.6.2","description":"Astrivya Knowledge Graph engine — SQLite-embedded, FTS5, vector embeddings, graph traversal, impact analysis, 3-way merge sync","directories":{},"_nodeVersion":"24.13.0","dependencies":{"sql.js":"^1.14.1","env-paths":"^2.2.1","typescript":"^5.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.8","typescript":"^5.0.0","@types/node":"^20.19.43","@types/sql.js":"^1.4.11"},"_npmOperationalInternal":{"tmp":"tmp/akg-core_0.1.1_1786185682541_0.7890373274344318","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@astrivya/akg-core","version":"0.2.1","keywords":["knowledge-graph","sqlite","fts5","graph-traversal","impact-analysis","astrivya"],"license":"Apache-2.0","_id":"@astrivya/akg-core@0.2.1","maintainers":[{"name":"amruth_jakku","email":"amruthjakku@gmail.com"}],"homepage":"https://github.com/astrivya/astrivya/tree/main/packages/akg-core#readme","bugs":{"url":"https://github.com/astrivya/astrivya/issues"},"dist":{"shasum":"a3b18903cc0613966e19c75d7b2c4912b7203e02","tarball":"https://registry.npmjs.org/@astrivya/akg-core/-/akg-core-0.2.1.tgz","fileCount":5,"integrity":"sha512-zhWkqVjXyiYpmUm2YsQ7xbETRLWyYrOxotS04Irxp65kWDMsn3B6FjM8UGaercBvcDIKAYo/b4IPmgAWdmqJhA==","signatures":[{"sig":"MEUCIQDGLiCey++FE47pRxx/ItWDQhnKCepdgEFFZe9fp67z3gIgFKQ3BL/+c041boYlk89H4jNrh/jOHyIgxUikd1pGTp4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":238494},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"ec2252b95b3e757e469987d2c9c7bdc6e368f6a2","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit --project tsconfig.json","test:watch":"vitest","prepublishOnly":"npm run typecheck && npm run build"},"_npmUser":{"name":"amruth_jakku","email":"amruthjakku@gmail.com"},"repository":{"url":"git+https://github.com/astrivya/astrivya.git","type":"git","directory":"packages/akg-core"},"_npmVersion":"10.8.2","description":"Astrivya Knowledge Graph engine — SQLite-embedded, FTS5, vector embeddings, graph traversal, impact analysis, 3-way merge sync","directories":{},"_nodeVersion":"20.20.2","dependencies":{"sql.js":"^1.14.1","env-paths":"^2.2.1","typescript":"^5.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.8","typescript":"^5.0.0","@types/node":"^20.19.43","@types/sql.js":"^1.4.11"},"_npmOperationalInternal":{"tmp":"tmp/akg-core_0.2.1_1786557788544_0.4267385761289193","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@astrivya/akg-core","version":"0.3.0","keywords":["knowledge-graph","sqlite","fts5","graph-traversal","impact-analysis","astrivya"],"license":"Apache-2.0","_id":"@astrivya/akg-core@0.3.0","maintainers":[{"name":"amruth_jakku","email":"amruthjakku@gmail.com"}],"homepage":"https://github.com/astrivya/astrivya/tree/main/packages/akg-core#readme","bugs":{"url":"https://github.com/astrivya/astrivya/issues"},"dist":{"shasum":"cf5df8a505a55fe75de3d9984a2651a117c7eadc","tarball":"https://registry.npmjs.org/@astrivya/akg-core/-/akg-core-0.3.0.tgz","fileCount":5,"integrity":"sha512-XzQ95mgsTe4MGM01vzl2P7K5nLrZoXisamzMSBOUrb8/x6V/fIAsVAcRX2taIg8+gd8tH1k+zRy+LD6hPqJjdA==","signatures":[{"sig":"MEYCIQDnBoS6FKPJ5f2d0CjrqxkvxHCMUTfQVND12ihP1lIC7QIhANLVNvUZ6JZO64jfnZdxX/thjQj5oQqOlrqFwsVPu0XX","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":238454},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"1da24ba6588ae6cfc89be554110db79732fea5de","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit --project tsconfig.json","test:watch":"vitest","prepublishOnly":"npm run typecheck && npm run build"},"_npmUser":{"name":"amruth_jakku","email":"amruthjakku@gmail.com"},"repository":{"url":"git+https://github.com/astrivya/astrivya.git","type":"git","directory":"packages/akg-core"},"_npmVersion":"10.8.2","description":"Astrivya Knowledge Graph engine — SQLite-embedded, FTS5, vector embeddings, graph traversal, impact analysis, 3-way merge sync","directories":{},"_nodeVersion":"20.20.2","dependencies":{"sql.js":"^1.14.1","env-paths":"^2.2.1","typescript":"^5.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.8","typescript":"^5.0.0","@types/node":"^20.19.43","@types/sql.js":"^1.4.11"},"_npmOperationalInternal":{"tmp":"tmp/akg-core_0.3.0_1786617894028_0.3005511896280524","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@astrivya/akg-core","version":"0.4.0","keywords":["knowledge-graph","sqlite","fts5","graph-traversal","impact-analysis","astrivya"],"license":"Apache-2.0","_id":"@astrivya/akg-core@0.4.0","maintainers":[{"name":"amruth_jakku","email":"amruthjakku@gmail.com"}],"homepage":"https://github.com/astrivya/astrivya/tree/main/packages/akg-core#readme","bugs":{"url":"https://github.com/astrivya/astrivya/issues"},"dist":{"shasum":"4c646af4823c42950114c0b0f21c972a13930995","tarball":"https://registry.npmjs.org/@astrivya/akg-core/-/akg-core-0.4.0.tgz","fileCount":5,"integrity":"sha512-3d/VVhGt7Y/oXWSHR/PHbub85NjChba6QUYqxkGJ25Sf24WriWn9YvymakMViYoxv5nReHULQiTJqVyeFJwZTw==","signatures":[{"sig":"MEUCIAI+rbk6KacAYS3TCH75bHZFXbiBeQMgKkoefz8lODPRAiEA2FFuS+PZTv00PVy94u6d7nTROeqYVpRRwas4eTahz0c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":255007},"main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"460d11b8c18e7c2607aa67550003181a6d570673","scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit --project tsconfig.json","test:watch":"vitest","prepublishOnly":"npm run typecheck && npm run build"},"_npmUser":{"name":"amruth_jakku","email":"amruthjakku@gmail.com"},"repository":{"url":"git+https://github.com/astrivya/astrivya.git","type":"git","directory":"packages/akg-core"},"_npmVersion":"10.8.2","description":"Astrivya Knowledge Graph engine — SQLite-embedded, FTS5, vector embeddings, graph traversal, impact analysis, 3-way merge sync","directories":{},"_nodeVersion":"20.20.2","dependencies":{"sql.js":"^1.14.1","env-paths":"^2.2.1","typescript":"^5.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","vitest":"^4.1.8","typescript":"^5.0.0","@types/node":"^20.19.43","@types/sql.js":"^1.4.11"},"_npmOperationalInternal":{"tmp":"tmp/akg-core_0.4.0_1786700057645_0.7713418520141684","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@astrivya/akg-core","version":"0.5.0","description":"Astrivya Knowledge Graph engine — SQLite-embedded, FTS5, vector embeddings, graph traversal, impact analysis, 3-way merge sync","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"engines":{"node":">=20"},"scripts":{"build":"tsup","typecheck":"tsc --noEmit --project tsconfig.json","prepublishOnly":"npm run typecheck && npm run build","test":"vitest run","test:watch":"vitest"},"dependencies":{"env-paths":"^2.2.1","sql.js":"^1.14.1","typescript":"^5.0.0"},"devDependencies":{"@types/node":"^20.19.43","@types/sql.js":"^1.4.11","tsup":"^8.5.1","typescript":"^5.0.0","vitest":"^4.1.8"},"keywords":["knowledge-graph","sqlite","fts5","graph-traversal","impact-analysis","astrivya"],"license":"Apache-2.0","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/astrivya/astrivya.git","directory":"packages/akg-core"},"homepage":"https://github.com/astrivya/astrivya/tree/main/packages/akg-core#readme","bugs":{"url":"https://github.com/astrivya/astrivya/issues"},"_id":"@astrivya/akg-core@0.5.0","gitHead":"859bac2e8372135c6dac12e492a6578556830315","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-OV1MtMXDhdz6WXSVV5+Qka3Bj50jnFyynyPdLuE81nwIcIqmkbrvA+Xw+s+69ILC1LC5HVmHa1o3es77ViMm2w==","shasum":"88dd59de4f5e860784ff7e07d89382456aed1542","tarball":"https://registry.npmjs.org/@astrivya/akg-core/-/akg-core-0.5.0.tgz","fileCount":5,"unpackedSize":255007,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD73wO/HethqWAGn3bsW1Ke18d8SZOi2v/serOiqYIUCQIhAL2kelaA7DAEOfxCrrX7GQqcwl9++WjAJo2Z51Gt6OCK"}]},"_npmUser":{"name":"amruth_jakku","email":"amruthjakku@gmail.com"},"directories":{},"maintainers":[{"name":"amruth_jakku","email":"amruthjakku@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/akg-core_0.5.0_1786734555985_0.3685610044741727"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-08T10:27:36.813Z","modified":"2026-08-14T19:09:16.290Z","0.1.0":"2026-08-08T10:27:37.130Z","0.1.1":"2026-08-08T10:41:22.760Z","0.2.1":"2026-08-12T18:03:08.699Z","0.3.0":"2026-08-13T10:44:54.188Z","0.4.0":"2026-08-14T09:34:17.789Z","0.5.0":"2026-08-14T19:09:16.126Z"},"bugs":{"url":"https://github.com/astrivya/astrivya/issues"},"license":"Apache-2.0","homepage":"https://github.com/astrivya/astrivya/tree/main/packages/akg-core#readme","keywords":["knowledge-graph","sqlite","fts5","graph-traversal","impact-analysis","astrivya"],"repository":{"type":"git","url":"git+https://github.com/astrivya/astrivya.git","directory":"packages/akg-core"},"description":"Astrivya Knowledge Graph engine — SQLite-embedded, FTS5, vector embeddings, graph traversal, impact analysis, 3-way merge sync","maintainers":[{"name":"amruth_jakku","email":"amruthjakku@gmail.com"}],"readme":"# @astrivya/akg-core\n\n**Embeddable knowledge graph engine** — SQLite-embedded, keyword full-text search, optional 384-dim vector embeddings, graph traversal, impact analysis, and last-write-wins sync/merge. Zero external services, one file per workspace.\n\n```sh\nnpm install @astrivya/akg-core\n```\n\n## Quick Start\n\n```typescript\nimport { createAkg } from \"@astrivya/akg-core\";\n\n// Initialize in any directory\nconst ctx = await createAkg(\"./my-project\");\n\n// Insert nodes (files, decisions, concepts)\nawait ctx.storage.upsertNode({\n  id: \"adr:001\",\n  label: \"Use React for frontend\",\n  type: \"adr\",\n  content: \"Decision to adopt React 18 with TypeScript for the SPA.\",\n  createdAt: Date.now(),\n  updatedAt: Date.now(),\n});\n\n// Insert edges (relationships)\nawait ctx.storage.addEdge({\n  source: \"adr:001\",\n  target: \"file:package.json\",\n  relation: \"references\",\n  weight: 1,\n});\n\n// Search\nconst results = await ctx.query.retrieve(\"React frontend\", 5);\n\n// Traverse graph\nconst path = ctx.traversal.shortestPath(\"adr:001\", \"file:package.json\");\n\n// Analyze impact\nconst report = ctx.impact.analyzeRemoval(\"adr:001\");\n```\n\n## API Reference\n\n### `createAkg(workspacePath): Promise<AkgContext>`\nOne-shot initialization. Creates/opens the `.astrivya/akg.db` SQLite database and returns all services.\n\n### `AkgStorage`\n\n| Method | Description |\n|--------|-------------|\n| `init(workspacePath)` | Open or create the database |\n| `upsertNode(node)` | Insert or update a node |\n| `getNode(id)` | Look up a node by ID |\n| `deleteFileNodes(filePath)` | Remove all nodes associated with a file |\n| `getNeighbors(id)` | Get immediate neighbor nodes |\n| `addEdge(edge)` | Insert a directed edge |\n| `upsertChunk(chunk)` | Index a content chunk (keyword + optional embedding) |\n| `getStats()` | Aggregate graph statistics |\n| `exportGraph()` | Serialize the full graph for sync |\n| `importGraph(data)` | Import a serialized graph (last-write-wins merge) |\n| `close()` | Flush and close the database |\n| `runQuery(sql, params)` | Execute raw SQL (advanced use) |\n\n### `AkgQuery`\n\n| Method | Description |\n|--------|-------------|\n| `retrieve(query, limit)` | Multi-strategy search (keyword + semantic + graph) |\n| `classifyQuery(query)` | Determine search intent weights |\n| `buildContext(query, results)` | Format results as LLM context block |\n\n### `GraphTraversal`\n\n| Method | Description |\n|--------|-------------|\n| `shortestPath(from, to)` | Shortest path between two nodes |\n| `topologicalSort(...)` | Topological sort with cycle detection |\n| `dependencies(id, transitive?)` | Nodes a node depends on |\n| `dependents(id, transitive?)` | Nodes that depend on a node |\n\n### `ImpactAnalyzer`\n\n| Method | Description |\n|--------|-------------|\n| `analyzeRemoval(nodeId)` | Impact report with risk score for removing a node |\n| `criticalityRanking(limit?)` | Rank nodes by how many depend on them |\n| `findCycles(maxLength?)` | Detect circular dependency loops |\n\n### Sync (Last-Write-Wins Merge)\n\n| Function | Description |\n|----------|-------------|\n| `mergeNode(local, remote)` | Merge two versions of a node |\n| `mergeChunks(local, remote)` | Merge chunk sets |\n| `mergeEdges(local, remote)` | Merge edge sets |\n| `mergeGraphs(local, remote)` | Merge full graphs |\n\n### Error Classes\n\n| Class | Code | When |\n|-------|------|------|\n| `AkgError` | `AKG_ERR` | Base error |\n| `StorageError` | `STORAGE_ERR` | Database I/O or schema failure |\n| `QueryError` | `QUERY_ERR` | Invalid query |\n| `TraversalError` | `TRAVERSAL_ERR` | Graph traversal failure |\n| `MergeError` | `MERGE_ERR` | Sync conflict |\n| `NotFoundError` | `NOT_FOUND` | Entity not found |\n| `ValidationError` | `VALIDATION_ERR` | Invalid input |\n\n### Types\n\n```typescript\ntype NodeType = \"file\" | \"function\" | \"class\" | \"interface\" | \"adr\" | \"task\"\n  | \"agent\" | \"agent_action\" | \"dependency\" | \"person\" | \"community\" | \"workspace\";\n\ntype RelationType = \"depends_on\" | \"imports\" | \"calls\" | \"implements\" | \"extends\"\n  | \"contains\" | \"references\" | \"documents\" | \"generated\";\n\ninterface AkgNode { id, label, type, content?, sourceFile?, metadata?,\n  createdAt, updatedAt, ... }\n\ninterface AkgEdge { source, target, relation, weight?,\n  confidence?, extractionMethod? }\n\ninterface AkgChunk { id?, nodeId, filePath, content, startLine?, endLine?,\n  embedding? }\n\ninterface AkgContext { storage, query, traversal, impact }\n```\n\n## How It Works\n\n```\n┌─────────────┐  SQLite Database (.astrivya/akg.db)\n│   Nodes     │  ├── nodes (graph vertices)\n│   Edges     │  ├── edges (directed relations)\n│   Chunks    │  ├── chunks (keyword-indexed content)\n│   Vectors   │  ├── embeddings (384-dim float32)\n└─────────────┘  └── communities, persons, metadata\n```\n\nThe database is a single file — copy it, sync it, commit it. No server, no API keys, no cloud dependency.\n\n## License\n\nApache 2.0\n","readmeFilename":"README.md"}