Skip to content

feat: add optional neo4j hybrid graph integration#77

Open
maehwasoo wants to merge 7 commits into
mainfrom
feat/issue-67-optional-neo4j-hybrid
Open

feat: add optional neo4j hybrid graph integration#77
maehwasoo wants to merge 7 commits into
mainfrom
feat/issue-67-optional-neo4j-hybrid

Conversation

@maehwasoo
Copy link
Copy Markdown
Owner

What

  • Add optional Neo4j hybrid integration in @ailss/core with env-driven settings, SQLite graph mirror sync, consistency status, and traversal helpers.
  • Run optional post-index Neo4j sync in @ailss/indexer with strict/best-effort fallback behavior.
  • Add MCP read tools neo4j_graph_status and neo4j_graph_traverse with explicit SQLite fallback when Neo4j is disabled or unavailable.
  • Add tests for Neo4j settings/MCP fallback behavior and update docs/env examples.

Why

How

  • Introduce AILSS_NEO4J_* configuration flags and a Neo4j mirror model (AilssNote, AilssTarget, AILSS_TYPED_LINK, AILSS_RESOLVES_TO).
  • Mirror SQLite notes and typed_links to Neo4j in deterministic batches and validate note/link count consistency.
  • Register Neo4j read tools in MCP and return structured fallback payloads when Neo4j connectivity/configuration is unavailable.
  • Run validation commands: pnpm build and pnpm check.

@maehwasoo maehwasoo added docs Improvements or additions to documentation enhancement New feature or request mcp MCP server indexer Indexer CLI core Core package monorepo Cross-cutting changes labels Feb 9, 2026
@maehwasoo maehwasoo self-assigned this Feb 9, 2026
@github-actions github-actions Bot added the ops CI / workflows / repo ops label Feb 9, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 191e9ec2b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/graph/neo4j.ts Outdated
Comment on lines +279 to +283
// Full mirror refresh
await session.executeWrite((tx) => tx.run("MATCH (n:AilssNote) DETACH DELETE n"));
await session.executeWrite((tx) => tx.run("MATCH (t:AilssTarget) DETACH DELETE t"));

await runBatchWrites(session, UPSERT_NOTES_CYPHER, notes, batchSize);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid destructive Neo4j refresh on sync failure

The sync routine deletes all AilssNote/AilssTarget nodes before any inserts, and each step runs outside a single transaction. If a later batch write fails (e.g., transient network/auth error or memory limit), the mirror is left empty or partially rebuilt. In non-strict mode the indexer logs and continues, so MCP will treat Neo4j as available but serve incomplete data. Consider staging writes in a transaction or swapping in temp labels to preserve the previous mirror on failure.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex
Addressed this issue, re-check the code

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Didn't find any major issues. 🚀

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core package docs Improvements or additions to documentation enhancement New feature or request indexer Indexer CLI mcp MCP server monorepo Cross-cutting changes ops CI / workflows / repo ops

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add optional Neo4j hybrid graph integration

1 participant