Repository navigation
Description
The current behaviour
Archiving a project does not affect knowledge retrieval. Its documents remain fully searchable and citable, and nothing indicates that.
convex/documents/access.ts builds the caller's readable project set by walking every project in the org and gating only on access:
const projects = ctx.db
.query('projects')
.withIndex('by_organization', (q) => q.eq('organizationId', args.organizationId));
for await (const project of projects) {
if (hasProjectAccess(project, context.teamIds, context.role)) {
projectIds.push(project._id);
}
}
archivedAt is never consulted — not here, not in projects/access.ts, not in the SQL pre-filter.
Why it's a question rather than a bug
The product already takes a position that removed content should stop answering: lifecycleStatus (active | trashed | expired | deleted) is honoured, via isActiveDocument in documents/filter_retrievable_rag_file_ids.ts. A trashed document is not retrievable.
So the asymmetry is deliberate-looking: trash means gone, archive means put away. Whether "put away" should also mean "stops answering questions" is a product call, and both readings are defensible:
Archive should exclude. Someone archives a project to retire it. If its documents keep informing chat answers, superseded material silently competes with current material, and the person who archived it has no way to know. That is the same failure shape as a stale label: the UI says "not in play", retrieval disagrees.
Archive should not exclude. Archive is explicitly not deletion. Retired projects are often exactly what you want to search — past contracts, finished engagements, previous decisions. Trash already exists for "stop using this", and overloading archive removes the only non-destructive way to keep material searchable while clearing it from the working set.
A middle option: keep archived material retrievable but demote it in ranking, and mark citations from archived projects so an answer visibly says the source is retired. More work, and needs the corpus to carry the archive flag.
If the answer is "exclude" — two gates, not one
Retrieval enforces scope twice, and both need to agree or the result is a silent half-fix:
- SQL pre-filter —
convex/knowledge/corpus.ts,d.project_id = ANY($n)against the readable set. Fixing only the Convex side leaves archived material occupying result slots before being filtered out, which degrades recall for the material that should be there. - Convex-truth re-check —
documents/filter_retrievable_rag_file_ids.ts→knowledgeScopeAllows, reading the live document row. This one fails closed, so fixing only here is safe but wasteful.
Excluding at the projectIds source (the loop above) covers both, since both derive from that set. That is probably the smallest correct change — but note it also affects every other consumer of knowledgeAccess(), so the blast radius wants checking before assuming it is a one-liner.
Related
hasProjectAccessreturns true for owners/admins before consulting teams, so an admin's searches already span every project — archived ones included. Whatever is decided, admins are the case most likely to notice.- A project with no teams is org-wide by definition (
getProjectTeamIds(...).length === 0), so an archived teamless project's documents are archived and org-wide readable. - Whatever is decided should be written down where the scope rules already are (
lib/knowledge/types.ts, besidedocumentScopeKind), since that is now the single place scope questions are answered.
No action proposed until the product call is made.
Activity
Israeltheminer commentedon Aug 18, 2026
Correcting the framing above. The original write-up presented this as two equally defensible readings, resting on trash meaning "removed" and archive meaning "put away". That axis does not hold — trashed rows are restorable too, so reversibility does not separate them. The stronger point was missed.
The codebase already has an archive convention, and retrieval is the exception to it. Archived rows are excluded from default reads, with an explicit opt-in where seeing them matters:
projects/queries.ts:136— the projects list queriesby_organization_archivedwitharchivedAt: undefinedso the scan never visits archived rows, and takes anincludeArchivedflag for the opt-in pathprojects/queries.ts:812—if (row.archivedAt) continue;projects/queries.ts:264,projects/schema.ts:72— archived tasks are excluded from the rollup counts, counted in no bucket at alldocuments/access.tsconsultsarchivedAtnowhere, and offers no opt-in either. So this is better described as one surface missing an established convention than as an open product question.What genuinely differs between trash and archive is the clock, not the reversibility:
trashed/expiredsit in a grace window and are eventually destroyed by the Pass-B sweep, whereasarchiveProjectstampsarchivedAtand stops — a stable resting state. That difference is about permanence, and it argues for trash's exclusion being fail-closed while archive's can safely be a default with an override. It does not argue for treating them oppositely in retrieval.The one asymmetry worth designing around is granularity. Trashing is per-document — someone judged that file. Archiving a project is a container action over documents nobody individually judged, performed by an admin who may not be thinking about documents at all. That argues for the exclusion being visible and overridable, not absent.
Revised proposal: archived projects' documents are excluded from retrieval by default, with an
includeArchived-style opt-in mirroringlistProjects; trash remains a hard fence. Still needs a product sign-off on the default, but the "leave it as it is" option is weaker than this issue first suggested.The two-gate note in the original description stands unchanged: excluding at the
projectIdssource indocuments/access.tscovers both the SQL pre-filter and the Convex re-check, since both derive from that set — and its blast radius across every otherknowledgeAccess()consumer still wants checking before assuming it is a one-liner.Israeltheminer commentedon Aug 18, 2026
Decided: archived material stays searchable and citable, and results say it is archived.
PR #3007 implements the retrieval half.
A result now carries two fields, because they are two different facts:
archived— the result itself is archivedprojectArchived— the project it belongs to is archivedA live task in a retired project may still be work nobody closed. An archived task is not. A document has no archive state of its own, so
projectArchivedis the only field it can carry.Nothing in code decides what chat says about them. The fields sit beside
statusandpriorityas data the assistant may use.Two notes on the original description:
The description proposed excluding at the
projectIdssource. That is not what shipped. Excluding there would have narrowed retrieval, which is the opposite of the decision.resolveKnowledgeAccessinstead returnsarchivedProjectIdsalongsideprojectIds, collected in the walk it already runs, so labelling costs no extra reads.The description also called this an asymmetry with the rest of the product, since other surfaces hide archived rows by default. That framing was mine and it overstated the case. Retrieval and a list view answer different questions: a list shows what to act on, a search answers what happened. GitHub and Slack both keep archived content searchable for that reason.
Israeltheminer commentedon Aug 19, 2026
Decided: an archived project's documents stay searchable and citable, and results say they are archived.
The owner's position, after weighing it against industry practice: archiving is not deletion, so hiding the material would lose institutional memory, and unarchiving must restore normal behaviour without re-indexing. Retrieval therefore keeps returning archived material; the label is what carries the context, and the model is not hard-coded to refuse or to caveat it.
Implemented in #3007. The caller's readable project set now also reports which of those projects are archived, and a hit carries
archived/projectArchivedso a citation can say so.lifecycleStatusstill removes trashed content from retrieval — that distinction is unchanged.Verified on a live deployment: an archived conversation remained in the corpus and stayed retrievable.
test(platform): give the capped-search crowd a live project
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
2 remaining items
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers
perf(platform): join readable projects in three server readers