跪拜 Guibai
← All articles
Artificial Intelligence

Flow2Spec Routes Project Knowledge So AI Agents Stop Asking the Same Questions

By liguochuan00 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Context-window bloat and repeated repository searches are a direct cost for teams using AI coding assistants. A deterministic, in-repo routing protocol makes knowledge reviewable in pull requests and prevents agents from acting on partial information, which matters most for hard constraints like idempotency, permissions, and data boundaries where a near-match isn't good enough.

Summary

AI coding tools burn context and miss constraints when they load monolithic rule files or re-search a repository from scratch. Flow2Spec replaces that with a four-layer knowledge structure inside the repo: a routing manifest, keyword matchers, topic summaries, and long-form docs. An agent follows a match→expand→verify→act pipeline that checks for information gaps before executing, and writes discovered facts back through structured deltas with optimistic revision locking to prevent stale overwrites in team settings. Task state stays local per developer; confirmed knowledge enters version control alongside code.

Takeaways
Monolithic rule files force agents to load irrelevant context and still miss constraints; a layered manifest→matcher→topic→long-doc structure lets an agent narrow scope before reading deeply.
Routing is deterministic, not semantic: explicit keyword matchers trade fuzzy recall for predictable, reviewable results suited to hard business rules.
A match→expand→verify→act pipeline inserts a gap-check step so the agent confirms it has enough information before executing, rather than acting on a partial hit.
Knowledge write-back uses structured kb-delta JSON with an action whitelist (append, replace, update frontmatter, create topic) so intent is visible in code review.
Topic revision acts as a disk-level optimistic lock: a delta applies only if the base revision matches the current disk revision, forcing a human to resolve semantic conflicts when two contributors modify the same topic.
Task state lives in a developer-local .task/ directory outside version control; only confirmed team facts enter the .Knowledge/ directory tracked in Git.
Conclusions

Deterministic routing is a deliberate trade-off that accepts lower recall for auditability. For constraints that cannot tolerate a probabilistic match, this is the right call, but teams will still need fallback search for unanticipated queries.

The revision-locking mechanism prevents text-level merge conflicts but deliberately punts semantic conflict resolution to a human. This is honest about the limits of automation: two non-overlapping text additions can still contradict each other as business rules.

Separating personal task state from team knowledge avoids a common failure mode where AI-generated checklists and temporary notes pollute the shared repository, but it also means the team loses visibility into what agents are doing mid-task unless they build separate observability.

Concepts & terms
Manifest routing
A JSON index that maps tasks to matcher files and topic files, plus declares topic dependencies, so an agent can find relevant knowledge without scanning the whole repository.
Match→Expand→Verify→Act pipeline
A four-step agent workflow: narrow candidates via keyword matchers, pull in dependency topics, check for information gaps, and only then execute the task. The verify step prevents acting on incomplete context.
kb-delta
A structured JSON change record that describes a knowledge modification (append, replace, update metadata, or create topic) with the developer's ID and the base revision it was built from, making knowledge changes reviewable in pull requests.
Topic revision locking
A disk-level optimistic concurrency control where each topic carries a revision number. A delta can only apply if its recorded base revision matches the current disk revision; a mismatch forces a human to reconcile the semantic conflict.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗