Skip to content

feat: add local note and graph context to AI agent - #54

Open
karmaboy1309 wants to merge 1 commit into
flint-md:mainfrom
karmaboy1309:feat/ai-local-note-context
Open

karmaboy1309 wants to merge 1 commit into
flint-md:mainfrom
karmaboy1309:feat/ai-local-note-context

Conversation

@karmaboy1309

Copy link
Copy Markdown
Contributor

Phase 1 of README Aim #1: ground Ollama answers in local vault notes.

Changes:

  • build_concise_system_prompt: now includes the user's custom system_prompt, passes the full vault memory context to the model, and enforces three explicit grounding rules so the model clearly states when the local notes do not contain the answer instead of hallucinating.
  • build_memory: bounds the MEMORY MAP section to only the selected relevant notes and their immediate 1-hop neighbors instead of dumping the entire vault connection graph, preventing context-limit overflows on large vaults.

Closes part of #1 aim (local note + graph context Q&A)

Phase 1 of README Aim flint-md#1: ground Ollama answers in local vault notes.

Changes:
- build_concise_system_prompt: now includes the user's custom system_prompt,
  passes the full vault memory context to the model, and enforces three
  explicit grounding rules so the model clearly states when the local notes
  do not contain the answer instead of hallucinating.
- build_memory: bounds the MEMORY MAP section to only the selected relevant
  notes and their immediate 1-hop neighbors instead of dumping the entire
  vault connection graph, preventing context-limit overflows on large vaults.

Closes part of flint-md#1 aim (local note + graph context Q&A)
Copilot AI lite review requested due to automatic review settings September 19, 2026 11:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Filter graph connections to the selected map nodes to fully enforce the context bound.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds local vault grounding and bounded graph context to AI agent prompts.

Changes:

  • Includes custom system prompts and grounding rules.
  • Limits memory-map context to relevant notes and nearby connections.
  • Uses bidirectional graph links.
File Summary
agent/​agent.py Updates prompt grounding and scoped graph context; graph edges still need filtering to prevent excessive context.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread agent/agent.py

for nid in sorted(map_nodes, key=lambda x: len(graph.get(x, set())), reverse=True):
if graph.get(nid) and nid in note_map:
conn_names = [note_map[cid]["title"] for cid in graph[nid] if cid in note_map]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants