Skip to main content

Module thinking

Module thinking 

Source
Expand description

Plan G t-006: read-side helper for surfacing captured thinking (Hypothesis / MentalModel / FailedAttempt / OpenQuestion) into prepare-change and context-for responses.

AcmeFlow refinement (2026-06-04): the helper now returns a struct (PriorThinking) carrying BOTH the projected entries and a ThinkingSummary metadata block. The summary always emits even when no entries surface, so callers can distinguish:

  • “thinking exists on the queried symbols but was filtered out” (e.g. all hypotheses below the confidence floor): surfaced == 0 AND by_kind_dropped populated → action: lower the floor or run asd think list <qname> to inspect.

  • “no thinking entries exist for the queried symbols”: all-zero summary → action: maybe capture some via asd think speculate/ model/question/failed.

  • “thinking exists somewhere in the workspace but not on these symbols”: matched_for_query == 0 AND entries_in_workspace > 0 → action: broaden the query, or this symbol cluster is unmapped.

entries_in_workspace is the only field that requires a workspace- wide scan; per the AcmeFlow design call (Craig, 2026-06-04) it’s computed ONLY when matched_for_query == 0 so the typical hot-path call pays nothing extra.

Structs§

PriorThinking
Result of gather_prior_thinking — entries projected to JSON + metadata summary explaining what was scanned, what surfaced, and what was filtered.
ThinkingSummary
Metadata accompanying the prior_thinking projection. Parallel in shape to FeedbackMetrics — same idea, different domain.

Constants§

DEFAULT_CONFIDENCE_FLOOR
Hypotheses with confidence below this are excluded from auto-surface (still queryable via asd think list). Plan G t-001 picked 0.3 as the default; callers may override.

Functions§

all_ledger_buckets
One-pass read of the whole ledger tree, grouped per symbol bucket.
all_symbol_entries
Bulk analog of the “list every indexed symbol’s ledger entries” loop (per-qname get_symbol_by_qname + per-symbol list_entries, which is minutes at 10k symbols on a cold FTS cache): ONE id-map build + ONE ledger-tree walk.
count_workspace_thinking
Workspace-wide count of thinking entries across all symbols. Used as a fallback signal when prior_thinking finds nothing on the queried symbols.
gather_prior_thinking
gather_prior_thinking_all
Workspace-wide variant: ONE ledger-tree walk + ONE id-map build instead of a per-qname symbol lookup + per-symbol ledger read. Same output shape and filtering rules as calling gather_prior_thinking with every indexed qname, but O(entries) instead of O(symbols × tree-depth) — the per-qname form measured ~9 minutes on a 9.6k-symbol repo with a cold FTS cache (Plan T t-007 finding); this walk is milliseconds.
live_entries
Per-bucket supersede filtering — the same rule as LedgerStore::list_entries (supersession never crosses symbols, so applying it per bucket is equivalent).