session-memory Phase 2: curate entrypoint + README (T06)

python -m session_memory.curate: refreshes detect candidates, then drives them
through review interactively or with --auto-approve (batch, gate-driven) /
--json. Emits a catalog diff summary; queues hub decisions when offline.
[curate] config gains decision_queue + workstream id. README documents the
detect -> curate -> distribute flow and the gate knobs. 2 new tests; suite 72/72.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 10:00:56 +02:00
parent 4b7a628b6f
commit 519e76442a
5 changed files with 265 additions and 7 deletions

View File

@@ -26,7 +26,14 @@ session_memory/
detect/signals.py # signal extractors over digests
detect/cluster.py # cluster signals -> candidate patterns + cross-flavor flag
detect/__main__.py # python -m session_memory.detect (ranked report)
config.toml # store paths, retention caps, sources, repo->domain map
curate/schema.py # SolutionPattern artifact + per-flavor rendering hints
curate/catalog.py # versioned, files-first Pattern Catalog (dedup on id)
curate/gating.py # promotion evidence bar + bloat guard
curate/review.py # discuss/approve/reject -> promote workflow
curate/decisions.py # hub decision audit trail (graceful local-queue fallback)
curate/__main__.py # python -m session_memory.curate (interactive / --auto-approve)
catalog/ # the committed Pattern Catalog (source of truth)
config.toml # store paths, retention caps, sources, repo->domain map, curate gate
```
The local store lives under `session_memory/.store/` (gitignored).
@@ -71,6 +78,42 @@ Candidates are persisted to a Tier 2 `patterns` table and are the input to the
Curate phase (Phase 2). Patterns whose evidence spans more than one agent flavor
are flagged `[CROSS-FLAVOR]` — the highest-value reuse targets.
## Curate candidates into the Pattern Catalog
Review detect candidates into versioned **Solution Patterns** held in the
files-first catalog (`session_memory/catalog/`). The flow is **detect → curate →
(Phase 3) distribute**; `curate` refreshes candidates by running detect first.
```bash
python -m session_memory.curate # interactive review (a/r/d per candidate)
python -m session_memory.curate --auto-approve # batch: promote all that clear the evidence bar
python -m session_memory.curate --json # machine-readable result
```
- **Promotion** writes a `SolutionPattern` file (id = source candidate key, so
re-promoting the same candidate dedups; content changes bump the semver and
archive the prior version to `<id>.history.jsonl`).
- The **evidence bar** (`[curate.gate]`) sets two floors: a promote floor and a
stricter *distribution* floor. A thin-but-real candidate lands `provisional`;
one clearing the distribution floor lands `approved` + `distribution_ready`.
- A **bloat guard** flags duplicate / near-duplicate candidates so the catalog
stays lean.
- Re-review is **idempotent** — a remembered decision is skipped unless the
candidate's evidence changed; a prior reject is not re-surfaced.
- Each final promote/reject is recorded as a **hub decision**; if the hub is
offline the decision is queued to `[curate].decision_queue` for later sync
(the same after-the-fact pattern used in Phase 1).
### Curate knobs (`[curate]` / `[curate.gate]` in config.toml)
| Key | Meaning |
|-----|---------|
| `catalog_dir` | committed Pattern Catalog dir (source of truth) |
| `review_log` / `decision_queue` | remembered decisions + pending hub decisions (gitignored) |
| `min_frequency` / `min_sessions` / `min_cost_impact` | floor to promote at all |
| `dist_require_cross_flavor` | require cross-flavor evidence to be distribution-eligible |
| `dist_min_frequency` / `dist_min_cost_impact` | stricter floor for `distribution_ready` |
## Retention knobs (`[retention]` in config.toml)
| Key | Meaning |
@@ -86,7 +129,7 @@ exists, except the explicitly-reported hard-cap overflow path.
## Tests
```bash
python -m pytest # 26 tests: schema, adapter, store, digest, retention, ingest
python -m pytest # schema, adapters, store, digest, retention, ingest, detect, curate
```
## Status
@@ -95,5 +138,7 @@ python -m pytest # 26 tests: schema, adapter, store, digest, retention,
adapter, ingest sweep.
- **Phase 1** (AGENTIC-WP-0003): Codex + Grok adapters, multi-file session merge,
and the Detect pipeline (signals → clustering → cross-flavor candidate patterns).
- **Next — Phase 2 (Curate):** review/approve candidates into a versioned pattern
catalog. **Phase 3 (Distribute) / Phase 4 (Measure)** follow per the PRD.
- **Phase 2** (AGENTIC-WP-0004): Curate — Solution Pattern schema, versioned
files-first Pattern Catalog, discuss/approve/reject review with an evidence bar +
bloat guard, and hub-decision audit trail.
- **Next — Phase 3 (Distribute) / Phase 4 (Measure)** follow per the PRD.