akm docs

Curate Workmap

Implementation note (added later, verified against src/commands/read/curate.ts): much of the "Preferred direction" / "Next Fix Candidates" work below has already shipped. curateSearchResults now selects via selectCuratedStashHits (score-first ranking through annotateCurateHit/compareCurateHits/ passesCurateScoreFloor, not "take the first hit per type"), collapseCurateFamilies/preferBroadRootRepresentative/getCurateFamily implement the asset-family root/child collapsing this document recommends, shouldRunCurateFallback triggers fallback on a weak result set (not only on zero hits, reversing the "Fallback Search Behavior" section below), and appendCurateSupportRef/mergeCurateSupportRefs attach graph-derived support refs (the "Graph Leverage" recommendation). The orderCuratedTypes function this document's "Execution Path" section names no longer exists — regex-based type reordering was replaced by the scoring pipeline above. The "Current Behavior" / "Current Curate Contract" sections below were accurate at the time they were written but are now describing the PRE-fix state in several places; re-verify against the functions above before trusting any specific "current behavior" claim in this document. Not fully re-audited line by line — this note flags the drift rather than rewriting the analysis.

When To Read This

Read this before changing akm curate ranking, fallback, follow-up generation, or agent-facing output.

This page is the shortest path to understanding:

Debate Outcome

Recent multi-agent review converged on the same conclusion:

Recommended fix order:

  1. Make curate selection score-first and diversity-second.
  2. Relax fallback suppression so one weak phrase hit does not block token fallback.
  3. Revisit follow-up generation after ranking quality improves.

Additional debate outcome:

Current Curate Contract

Execution Path

Read these first:

Key functions in src/commands/read/curate.ts (current names; orderCuratedTypes() no longer exists — see the implementation note above):

Ranking And Selection Rules

Current behavior:

Why this is a problem:

Preferred direction:

Small type-aware corrections that are considered in-bounds:

Corrections that are currently considered too risky:

Asset Families

Curate should think in terms of asset families, not just isolated types.

Practical examples in this repo:

Desired behavior:

This should start as an explicit structural heuristic, not semantic lineage inference.

Fallback Search Behavior

Current behavior:

Why this is a problem:

Preferred direction:

Enrichment And Follow-Up Fields

Current behavior:

Product implication:

For agent consumers, the desired optimization order is:

Output Shape And Formatting

Read:

Important details:

Telemetry And Retrieval Signal

Read:

Important detail:

This means ranking changes do not just affect UX. They also affect downstream improvement-loop evidence.

Graph Leverage

Retired (0.9.17-alpha.9): the LLM entity graph this section recommends leveraging is gone — graph-extraction, graph_meta/graph_files/ graph_file_entities/graph_file_relations, and akm show's related block it fed are all deleted. It was already superseded before that: #935 (0.9.17-alpha.8) added the first-class asset->asset edge table this section says doesn't exist (asset_links, declared links), and curate's support refs (buildCurateSupportRefs in src/commands/read/curate.ts) come from declared links now, not graph data — the implementation note at the top of this document already flags that rename. Kept below for historical context only; do not implement against it.

Existing graph signal:

Limits:

Recommended first graph-aware use in curate:

What not to do yet:

Tests That Pin Behavior

Start with these:

What they cover:

Search-ranking baselines that curate should respect:

Known Gaps / Mismatches

Safe Edit Checklist

Before editing curate:

  1. Read the three curate-focused test files.
  2. Read src/commands/read/curate.ts top to bottom.
  3. Confirm whether you are changing:
    • post-search selection
    • fallback triggering
    • fallback token extraction
    • output contract
    • telemetry side effects
  4. Keep CLI surface and output-shape tests passing unless you intentionally change the public contract.
  5. If you improve ranking quality, convert current characterization tests that encode bad behavior into regression tests for the new intended behavior.

Useful AKM Queries And Refs

Queries:

akm search "curate rerank"
akm search "curate output shape"
akm search "search discovery curate"
akm search "curate telemetry usage_events"
akm search "curate fallback query"
akm search "curate quality baseline"

Historical context refs:

Note: knowledge/curate-command-flags-inert is historical context only. It describes an older output-shaping limitation that is no longer current now that src/output/shapes/curate.ts exists.

Next Fix Candidates

Highest-value next changes:

  1. Replace hard one-per-type selection with score-first shortlist selection plus optional soft diversity.
  2. Replace empty-only fallback triggering with weak-result fallback triggering.
  3. Add simple family-aware root/child collapsing for obvious structural bundles.
  4. Add regression tests asserting that docker-specific curate queries stop surfacing unrelated commands/release-manager filler.
  5. Attach lightweight related-asset hints using existing graph data after ranking quality is fixed.
  6. Revisit followUp generation after ranking quality is fixed.