Repository navigation
feat(tags): filter the context operations by D156 tags (step 3) - #615
Merged
Merged
Conversation
….4 fact evidence (checkpoint) claims_and_sources_context@5, facts_context@5 and combined_context@6 take the D134/D156 documents filter as an eligibility input of every nomination channel and re-check it at confirmation. Filtered fact reads draw support from matching documents only, contradictions and co-members from every document marked in_documents_filter, with two-sided evidence totals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VYytLf2PUQ2RVpEZYENzsq
…t parity for the context filter Operation versions 5/5/6 roll surface_manifest_hash. The TypeScript client takes documents on factsContext, combinedContext and claimsAndSourcesContext and checks the matching evidence total like the Python model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VYytLf2PUQ2RVpEZYENzsq
…plan step 3 status Assured operations, MCP, HTTP operations, SDK, TypeScript, CLI and result types document the filter, its §4.4 evidence marks and two-sided totals; not-built-yet no longer lists it. The tag guide gains 'Ask about one project'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VYytLf2PUQ2RVpEZYENzsq
… roll; meaningful resolve_entity check Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VYytLf2PUQ2RVpEZYENzsq
…-context-ops Takes step 2's review rounds. Facts under a documents filter now nominate through search_facts_scored (with its exact tier for a selective filter); its fast base-table support probe becomes the shared document_filters.fact_supported_matching used by confirmation and co-member marks too. Generated contracts, manifest, fixtures and docs regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VYytLf2PUQ2RVpEZYENzsq
The D156 filter disclosures are omitted from unfiltered reads with Field(exclude_if=...), which Pydantic supports from 2.12. Serialization and schema generation were checked at 2.12.0 (OpenAPI byte-identical). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VYytLf2PUQ2RVpEZYENzsq
…tered and filtered fact reads (PR #615 review r1) The contracts exporter marks Pydantic exclude_if-None fields with x-exclude-if-none (refusing any other exclude_if rule). The TypeScript validator no longer fills their null default and dump() drops a null, so False and 0 survive. The facts_context parity fixtures now return a fact with evidence, totals and a co-member, unfiltered and filtered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VYytLf2PUQ2RVpEZYENzsq
…ument-tags-context-ops Takes step 2's claim-keyed fact enumeration and main's PostgreSQL 18 baseline (#616). fact_supported_matching stays in core/document_filters. Manifest, OpenAPI, TypeScript contracts and parity, D143 fixtures, storage-capture pin, LoCoMo/open-query hash pins and llms*.txt regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VYytLf2PUQ2RVpEZYENzsq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
D156 delivery step 3 (builds on #606 and #614, both merged): the
documentsfilter on the three context operations, and with it the §4.4 fact-evidence rule.Design:
plan/designs/document_tags_design.md§4 / §6 / §8,decisions.mdD156,plan/designs/open_query_space_design.md§3.1. Plan:plan/plans/document_tags.md(now: all steps implemented).What changes
Operations.
claims_and_sources_context@5,facts_context@5,combined_context@6take an optionaldocumentsobject — the same D134/D156 filtersearchtakes,tagsincluded. Validated before retrieval (invalid_parameterfor shape errors,unknown_tag422 naming every unregistered tag).combined_contextpasses it unchanged to both children. Withentity_idsan item must satisfy both. The other inputs (time, hops, predicate, entity caps) are unchanged.surface_manifest_hashrolls; the operation linter's canonical versions follow.Eligibility before ranking (D142/D153), reusing the step 2 compiler — no new filter path, no post-filtering.
documents(step 2); the entity-scopednominate_testimony_scorednow applies it too (claims throughclaim_selected_matching, i.e. the same-occurrence D140 rule; chunks on the candidate version), including the §3.7 pending-probe replay. Confirmation (_confirm_claims/_confirm_chunks) re-checks it, now also withentity_ids.search_facts_scored(the pathpredicatealready used), so step 2's exact tier for a selective filter and its loop for a broad one both apply; the entity-profile channel too. Confirmation re-checks the filter. The fast base-table support probe from D156 step 2: filter search and search_documents by document tags #614 is now the shareddocument_filters.fact_supported_matching, used by P1, confirmation and the co-member marks.§4.4 in the
facts_contextevidence path. One templated evidence statement (_fact_evidence_statement): with a filter, each lineage getsin_filter(a matching occurrence that also passes the time scope's evidence gate), its representative claim is a matching one when it has one, matching lineages rank first in each stance (so they are allocated first within the unchangedmax(60, 2k)budget), supporting rows from non-matching lineages are dropped (they still count), and each row carries the stance's matching-lineage count. Output:fact_evidence[].in_documents_filter,evidence_totals[].in_documents_filter_totalbeside the unchanged deployment-wide D54total, andcontradiction.co_members[].in_documents_filter(co-members come from everywhere, as before). Fact value, window, support state, contradiction status andevidence_countare never touched.Unfiltered responses. I chose to omit the new fields when no
documentsfilter is given (Field(default=None, exclude_if=lambda v: v is None)), so unfiltered payloads are byte-identical to before (only the operation/tool versions in descriptors change). Evidence:test_d143_default_operations_pg.py(real PostgreSQL operation responses vs. the pre-D143 capture, incl.fact_evidence/evidence_totals) passes unchanged, andtest_a_filtered_fact_is_never_re_adjudicatedasserts the unfiltered JSON has no filter keys. OpenAPI gains the three optional properties (stripped in the D143 additivity test like the other D156 additions).§4.5. A completed empty filtered read's
known_emptyexplanation ends with "no live document matches the documents filter" or "live documents match the documents filter, but none of them says anything relevant"; incomplete reads keepboundary.Surfaces. HTTP
POST /operations/{name}mapsUnknownTagErrorto 422unknown_tag; in-process MCP maps it tounknown_tag; MCPtool_version5/5/6 with adocumentsschema (thetagsobject is literallysearch_documents' schema) and descriptions telling agents to calllist_tagsbefore filtering by tag; SDKdocuments=(model or dict, validated locally) on the three context methods; CLI--tag/--any-tag/--not-tagonremember query(text,--combined,--layers); TypeScriptdocumentsonfactsContext/claimsAndSourcesContext/combinedContextplus the matching-total validator. OpenAPI, TS contracts/parity fixtures, D143 fixtures, manifest, storage-capture source pin and LoCoMo protocol hash regenerated.Docs (D66). Assured operations (new "The documents filter" section, versions, params), HTTP operations, MCP, Python/TypeScript SDK, CLI, result types, search page, tag guide ("Ask about one project"), cloud compatibility,
not-built-yet(now only fact lookups and SQL functions lack the filter),llms*.txt.Tests
src/tests/surfaces/test_document_tag_context_pg.py(integration inventory): the design's Autoboard 12h vs Legalit 6h example end to end (support only from Autoboard, Legalit contradiction and 6h co-member marked out, totals (2,3,2)/(1,1,0) equal hand-counted lineages); fact value/support identical to unfiltered; testimony strictly limited;combined_contextchildren equal direct calls; each grain before the cut at k=1 (facts on both the exact tier and the loop);entity_ids+documents;unknown_tagbefore any embedding call andinvalid_parametershapes; §4.5 both explanations; work-bounded read →boundary;resolve_entityunaffected by tag state.src/tests/surfaces/test_document_tag_context_surfaces.py(unit inventory): catalogue/schemas/versions, coercion, executor passes the same filter to both children, HTTP + SDK + unknown_tag, in-process MCP, CLI flags, optional fields absent when unfiltered.Deviations
search_facts_scoredinstead ofnominate_facts_scored(same as thepredicatepath) so the filter reuses step 2's qualified exact-tier/loop execution rather than adding a second filtered fact nomination.null) on unfiltered reads, to keep those payloads byte-identical.list_tagsguidance).Rule 4 / D56: read-path only; no ingestion, chunking, extraction or reuse-key code is touched.
Review fixes (GPT 6.1 sol, three rounds, approved on bf84c68)
>=2.12, whichexclude_ifrequires, so unfiltered reads omit the new fields at every allowed version.x-exclude-if-none, anddump()drops a null but keepsfalseand0. Parity fixtures cover unfiltered and filtered fact reads.Verification
check:generated,check:parity,typecheck,npm testall pass. Website builds (public and cloud) and the docs truth checks pass.Contributor agreement
Signing on behalf of a legal entity (leave blank if accepting individually):
🤖 Generated with Claude Code
https://claude.ai/code/session_01VYytLf2PUQ2RVpEZYENzsq