Repository navigation
Adding a connector
Thomas Maerz edited this page Oct 4, 2026
·
1 revision
The first release ships an OpenCode connector in backfill.py. The next refactor should separate source adapters from the common distill/submit engine. New adapters should already follow the contract below.
class Connector:
def stats(self) -> dict: ...
def list_sessions(self, limit=None, offset=0) -> list[SessionRef]: ...
def build_transcript(self, session_id: str) -> Transcript: ...SessionRef needs a stable ID, title, project/workspace, and timestamp. Transcript needs normalized chronological text plus a substantive-content count.
- Read-only source access. Enforce it in the storage client when possible.
-
Stable IDs. Resume depends on them. Namespace IDs (
claude:<id>) if stores can collide. - Chronological ordering. Preserve causality and outcomes.
- Bounded fields. A single tool call or attachment must not consume the session budget.
- Explicit role mapping. Normalize user, assistant, reasoning, and tool events.
- Source metadata. Submit connector name, source ID, title, workspace, and time to Cognee.
- No silent errors. Malformed records are counted and logged; do not classify parse failures as junk.
connectors/
base.py
opencode.py
claude_code.py
cursor.py
pipeline/
distill.py
scrub.py
submit.py
state.py
The stdlib-only goal is useful but not absolute. Prefer a small, auditable dependency over a brittle custom parser.
Every connector should ship an anonymized fixture containing:
- a short successful session;
- an aborted/no-value session;
- a long session with a useful result at the end;
- tool output containing a synthetic API key to verify redaction;
- malformed records that must surface as errors;
- duplicate/resume execution proving idempotence.
A connector is ready when:
- it never writes to the source;
- a three-session smoke test creates useful notes;
- stop/restart does not lose or duplicate accepted work;
- at least ten known-answer recall questions pass manual review;
- logs and persisted notes contain no synthetic secrets from the fixture.
- Claude Code JSONL under
~/.claude/projects/ - Cursor / Windsurf transcript exports
- Cline / Continue storage
- generic normalized JSONL for external ETL