feat(coding-agents): apply retain attribution to all ingestion paths - #3418
Conversation
Review follow-up. Both survey-baseline writes branched into two complete
client.retain(...) calls that differed only in whether `{ metadata }` was passed
— six duplicated argument lists between them, which is where a later edit updates
one and misses the other.
`retain` only assigns metadata when it is truthy, so `{ metadata: undefined }`
already omits it and one call covers both cases. That is what knowledge-tools.ts
does with `Object.keys(metadata).length ? { metadata } : {}`.
The marker assertion in session-start.test.ts gains the opts argument, since the
call now always passes one. Behaviour is unchanged: with no retainMetadata
configured the stamp is empty and nothing reaches the API.
fb658f9 to
4b112a5
Compare
|
Reviewed and tested locally — rebased onto current main (it was 13 commits behind, predating the cursor fix, Prime Agent and the What's rightThe merge order is correct in every path — configured first, built-ins last, deduped: [...new Set([...(stamp?.tags ?? []), "source:git"])]
{ ...stamp?.metadata, source: "git", repo: repoName, … }So source identity stays authoritative, and because every path builds its stamp through
What I changedBoth survey-baseline writes branched into two complete I assume the branching existed to keep that assertion passing unchanged — reasonable, but the test was the thing to update. One thing worth knowingWith Merging once CI is green. Thanks — partial attribution really was the gap, and this closes it cleanly. |
Extends the coding-agents integration's existing
retainTagsandretainMetadatasupport to every document it writes, rather than only live session write-back.This includes:
hindsight_ingest_documentConfigured attribution is merged with each document's built-in tags and metadata, with built-in source identity remaining authoritative.
Why
In shared-bank deployments, consistent attribution is needed to identify and filter documents by project or other configured provenance. Partial attribution leaves Git, survey, and manually ingested documents indistinguishable across projects.
Notes
This is additive and disabled by default. Existing configurations without
retainTagsorretainMetadataretain their current behavior.Verification