Skip to content

feat: Knowledge Extraction — spec + implementation workflow#14

Closed
khaliqgant wants to merge 2 commits intomainfrom
feat/knowledge-extraction-spec
Closed

feat: Knowledge Extraction — spec + implementation workflow#14
khaliqgant wants to merge 2 commits intomainfrom
feat/knowledge-extraction-spec

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Mar 27, 2026

Knowledge Extraction for Relayfile

Problem

When multiple agents work on the same codebase, each starts cold. Agent 3 discovers conventions, dependencies, and gotchas — but agent 7, starting 20 minutes later, has none of this context.

Solution

File-path-scoped knowledge annotations that agents write (explicitly or auto-extracted from diffs/trajectories) and query before starting work. The relay broker can inject relevant knowledge into task preambles automatically.

What's included

  • Spec: docs/knowledge-extraction-spec.md — full design covering data model, API, extraction strategies, broker integration
  • Workflow: workflows/relayfile-knowledge-extraction.ts — 7-step implementation workflow (2 Claude + 2 Codex agents)

Key design decisions

  • Knowledge lives on files as metadata, not in a separate store
  • Path-based lookup (no embeddings needed for v1)
  • Automatic diff-based extraction (regex/pattern matching, no LLM)
  • Trajectory retrospectives as a knowledge source
  • Token-budgeted injection at broker dispatch time
  • Complements (not replaces) the existing knowledge-graph spec (derivation DAG)

Relationship to other specs

Spec Tracks Purpose
Relayfile v1 Files, revisions, sync Storage
Knowledge Graph v2 Derivation DAG, staleness Structural relationships
Knowledge Extraction Conventions, lessons, gotchas Agent context injection
Trajectories Full work history Source for extraction

Not included (future phases)

  • Broker integration (needs relay SDK changes)
  • Semantic search / embeddings
  • Curation UI

Open with Devin

Spec: docs/knowledge-extraction-spec.md
- Agents attach knowledge annotations to file paths at write time
- Path-scoped queries: 'what do we know about packages/billing/**?'
- Auto-extraction from diffs (imports, env vars, test frameworks)
- Trajectory retrospective mining for lessons/conventions
- Relay broker injects relevant knowledge into agent task preambles
- Builds on existing FileSemantics.properties model, no new database

Workflow: workflows/relayfile-knowledge-extraction.ts
- 7 steps, 4 agents (2 Claude architect/reviewer, 2 Codex builders)
- Phase 1: D1 storage + API routes + SDK methods
- Phase 2: Diff-based auto-extractors
- Phase 3: Trajectory integration
- Follows NightCTO workflow lessons: granular steps, output-constrained, Codex builders
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 4 additional findings in Devin Review.

Open in Devin Review

"description": "CLI for relayfile — real-time filesystem for humans and agents",
"bin": {
"relayfile": "bin/relayfile"
"relayfile": "scripts/run.js"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 package-lock.json not updated after bin path change, can break npm ci

The package.json bin entry was changed from bin/relayfile to scripts/run.js, but the root package-lock.json still records the old value ("relayfile": "bin/relayfile" at package-lock.json:531). Since packages/relayfile is an npm workspace member (declared in root package.json:workspaces), running npm ci or npm install at the repo root may fail or produce incorrect bin symlinks because the lockfile metadata is out of sync with the actual workspace package.json.

Prompt for agents
Run `npm install` (or `npm install --package-lock-only`) at the repository root to regenerate the root package-lock.json so that the workspace entry for packages/relayfile reflects the new bin path `scripts/run.js` instead of the stale `bin/relayfile`. The current stale entry is at package-lock.json line 531.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@khaliqgant
Copy link
Copy Markdown
Member Author

Closing — premature feature spec, will revisit when core is stable

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.

1 participant