At a glance
Dates are PyPI upload dates. All scoring options added after 0.1.0 are opt-in. At their defaults, scores match the previous release, except for the 0.3.1 fixes.
| Version | Released | Headline | New public API |
|---|---|---|---|
0.3.1 | Not yet on PyPI | Matching fixes, loud fallback | fallback_counts, reset_fallback_counts |
0.3.0 | 2026-10-20 | Synonyms, phrases, tier weights, calibration | SynonymMap, load_pack, calibrate, LabeledExample, ThresholdStats, CalibrationReport, TIER_NAMES |
0.2.1 | 2026-07-11 | Recency decay, score explanations | ScoreExplanation, Recency, no_decay, exponential_decay, linear_decay |
0.2.0 | Not published | Literal anchors, locate() | locate, Candidate |
0.1.0 | 2026-07-10 | Initial release | DeepCQ, MemorySchema, QueryResult, OptimizationMetrics and the five tier classes |
0.3.1Matching fixes and loud fallback
Not yet on PyPI. Recalibrate after upgrading. Several of these fixes change scores or returned content by default. Thresholds tuned against 0.3.0 may need another pass with calibrate().
Fixed
- Literal anchors match only the exact figure or whole word. In 0.3.0 an anchor was a plain substring test, and an anchor hit forces a score of 1.0. So “is 10 a good entry?” force-included every section that contained “100”, “2010” or “2.10”.
- “10” no longer matches “100”, “2010”, “2.10”, “10.5”, “10th”, “10-K” or “10-year”. It still matches “top 10”, “$10” and the range “10-15%”.
- “15%” no longer matches “115%”, “15.5%”, “-15%” or “−15%”.
- Extracted numbers keep a leading minus sign, so “-15%” and “15%” are different anchors, and “-15%” doesn’t match the range “10-15%”.
- Matching is textual: “1000” doesn’t match “1,000”, and “15” doesn’t match “15.0”.
- Section headers end at a word boundary.
"## SEC"no longer matches a"## Sector"header. - Sections that no tier contains score 0.0. Before, a match on a section’s name or keywords alone gave it a passing score, and the section was listed in
sections_includedwith no content. These sections now haveScoreExplanation.present = Falseand appear only in the newQueryResult.sections_absent.ScoreExplanation.absent_scorekeeps the score that the name and keywords would have given. - A query that matches only absent sections returns no section content. The query asks about data that memory doesn’t hold, so it no longer triggers the include-all fallback, which used to return all of memory.
- Headers must start a line in the sectioned tiers (state, notes, reference). A mid-line mention such as “see [status] for uptime” started the
statussection at that line, so the wrong text was scored and returned and the real section was lost. The free-text tiers (cache, history) still score a section from a mention anywhere in a line, such as “USER: [deploy] failed”, using the newMemorySchema.mention_pattern(). - Data lines no longer end a section. With the default
"[{name}]"header format, any line that started with[ended the section. That cut off content after lines such as[AAPL, MSFT],["a", "b"]or a Markdown link. A section now ends at the next header line. A header line is either a declared section’s header, or the header format filled with a name that starts with a letter and has no commas, quotes or brackets, followed by a space or the end of the line. Formats with nothing after{name}, such as"## {name}", behave as before. reduction_pctis never negative. Returned pieces are now joined with a single newline, like the original text, instead of a blank line. The filtered content can no longer be longer than the input.
Added
- Loud fallback. When
fallback_include_allreturns all of memory unfiltered, the result hasfallback_used = Trueand afallback_reason, and a warning is logged on the"deepcq"logger, with the query cut to 80 characters.deepcq.fallback_counts()returns process-wide totals by kind (no_section_scored,no_section_present,absent_only), anddeepcq.reset_fallback_counts()sets them back to zero. QueryResult.sections_absent,ScoreExplanation.presentandScoreExplanation.absent_score, described under Fixed.
0.3.0Synonyms, phrases, tier weights and calibration
Released 2026-10-20. All new scoring options are opt-in MemorySchema fields. At their defaults, scores are identical to 0.2.1; this was checked against a copy of the 0.2.1 scorer. Full rules are in the 0.3.0 specification.
Added
- Synonym vocabularies. Set
vocabulary=to aSynonymMap, or use the built-inload_pack("finance"). A section’s vocabulary is expanded with every synonym cluster that has a term in that section, so “eps” matches stored “earnings per share” and the other way round. Only the section side is expanded, so the query’s token count, which is the score’s denominator, doesn’t change. - Phrase matching.
phrase_sizesandphrase_boostadd a capped bonus for multi-word phrases (stemmed n-grams) that match. The bonus can only raise a score. - Per-tier weighting.
tier_weightsandschema_weightweight a match by where it was found. Each query token counts once, at the highest weight among the tiers and the section name it appears in.ScoreExplanationgainstier_contributionsandmatched_phrases. - Threshold calibration.
calibrate()tries a range of thresholds over a list ofLabeledExamples, running onequery()per example, and reports micro-averaged precision, recall and F1 for each threshold. An optionalmin_precisionfloor is flagged when no threshold meets it. locate()supportsanchor_patternsand recency, and reports match details for each chunk.
Changed
- Per-tier vocabulary caching. Each memory tier has a version counter that every write increments. Extracted section text and tokens are cached per schema and section, so unchanged tiers skip regex extraction and tokenization on the next query.
0.2.1Recency decay and score explanations
Released 2026-07-11.
Added
- Recency decay. Section scores can be weighted by age through a pluggable
Recencysetting ordecay_fn.no_decay,exponential_decayandlinear_decayare included. - Score explanations.
ScoreExplanationreports which tokens and anchors produced each section’s score, for debugging and for interfaces that show users why a section was included. - Anchor extraction recognizes version numbers, percentages, identifiers and plain numbers, and the patterns can be overridden on the schema.
Fixed
- A percentage anchor such as “15%” no longer also produces a duplicate bare-number anchor (“15”). The anchor patterns used to be matched independently, without tracking which parts of the query had already matched.
0.2.0Literal anchors and locate()
Never uploaded to PyPI. Its changes were first published in 0.2.1.
Added
- Literal-anchor matching. Emoji, symbols and quoted phrases in a query force a section to be included when it contains them, even when word overlap alone would miss it.
locate()finds the relevant chunks of a plain document in one call, without setting upDeepCQor aMemorySchema. It returnsCandidateobjects. See Search plain documents.
0.1.0Initial release
Released 2026-07-10.
DeepCQandMemorySchema: declare named sections and score each one against the words of the query, using regex and a light stemmer. No embeddings and no runtime dependencies.- Five memory tiers:
AppState,SessionCache,History,LongTermStoreandReferenceData. QueryResultwith filteredcontent, scores, included and excluded sections, andOptimizationMetrics.