Skip to content

Facts: current state + why per topic, looked up instead of re-derived #1063

Closed

Description

@scuttletoby

Problem (owner, 2026-11-23): after compaction, a handoff or a new session, agents forget what was already done and spend usage re-deriving it, sometimes wrongly (for example calling hardware broken that was set up and switched off on purpose the day before). The answer usually already exists in a research note, a runbook, an issue or a state file, but nothing tells the agent to look, and nothing gives the short "current state and why" without the full history.

What: a small facts store plus lookup, part of the fork kit.

  • Facts files: one short Markdown file per thing (a machine part, a service, a feature, a decision). Frontmatter: topic, keywords, place, updated, source (links to the issue/runbook/research). Body lines: State:, Why:, Check: (a command that proves the state live), Don't: (the known wrong conclusion), optional Next:. Current state only, no history; history stays in git and issues.
  • Places: facts live where the thing lives. Which folders are searched comes from config, never from code: machine facts in the machine config folder, project facts in the project (private projects keep them private), fork-feature facts in the fork. The fork ships the tool, format and hooks only.
  • Lookup: facts <words> searches topics, keywords and bodies across the configured folders and prints the matching cards (state, why, check, source) compactly. facts --index prints one line per topic.
  • Hooks: the session-start hook (startup, resume and after compaction) prints the facts index and one line: "Before diagnosing or redoing something, run facts <topic>." Compaction instructions say to keep fact topics, not details. Per-project text comes from config (G10 G10 Orchestrator state, handoff and session hooks as a fork feature #851 owns the hook kit; this adds a section to it).
  • Upkeep: a writer that changes the state of a thing updates its card in the same change. The daily gardener reports cards older than N days, cards whose source path is gone, and folders over a size cap (report only).

Not in scope: full history, a database, embeddings. Plain files and grep-level search are enough.

General vs project: general: the format, facts CLI, hook section, gardener check, config keys (facts.dirs, facts.staleDays). Project: the folder list and the cards themselves (kept in each project, private where needed).

Done when: a fresh session shows the facts index; facts gpu on a test folder returns the right card; the format, config keys and upkeep rule are documented; tests cover search, the index, a missing folder, an empty folder and a card with broken frontmatter.

Related: #851 (G10 state, handoff and session hooks), #877 (handoff instead of compaction), #834.

🤖 Generated with Claude Code

Activity

  1. scuttletoby commented on Nov 23, 2026

    @scuttletoby
    OwnerAuthor

    Scope change (owner, 2026-11-23): the store is a quick table, not cards or research notes. One row per thing: Thing | What we made / how to use it | State now | Why | Updated. Example row: "Example GPU | gpu on|off|status helper, turned off at boot | OFF on purpose; the vendor tool fails while it's off | quiet fans | 11-23". It answers "did we make anything for X, and what is its state?" in one glance. No history and no links to long documents needed.

    • Each place (machine, project, fork) has one table file, for example STATE.md. facts.dirs lists where they are.
    • facts <words> prints the matching rows with the header. facts --index prints the Thing column.
    • The session-start hook prints the Thing column (capped) and "check the state table before diagnosing or redoing something".
    • The gardener reports rows whose Updated is older than facts.staleDays, and tables over a row cap.
    • The upkeep rule stays: a change to a thing edits its row in the same change.

    🤖 Generated with Claude Code

  2. scuttletoby commented on Nov 23, 2026

    @scuttletoby
    OwnerAuthor

    Token budget and handoff (owner, 2026-11-23): keep the always-loaded part small.

    • Session start, resume and after compaction or handoff: print only the Thing column (about 60 short names per table). Never print whole rows there; rows come on demand from facts <words>.
    • Handoff instead of compaction (Handoff instead of compaction: finish the feature (agent source, thread menu, roles, later items) #877): the handover note holds only "what I am doing right now". It points to the state tables and does not copy rows from them. When a thread's work changes the state of a thing, it edits that row before it hands off.
    • Target: under 1,000 tokens per session for the facts index across all tables.

    🤖 Generated with Claude Code

  3. scuttletoby commented on Nov 23, 2026

    @scuttletoby
    OwnerAuthor

    Review of #1065: FIX FIRST. The hook can't block a session, but two things must be fixed before merge:

    • A test fixture date makes CI fail from 2026-12-02.
    • --check reads every project's tables, so it could leak one project's table names into another project's report.

    The fix round also covers ten minor findings: hang on non-regular files, an uncapped hook output, parser edge cases, date edge cases, duplicate folders, and not overwriting an unrelated facts command.

    Added scope from the owner: facts also searches a private record repo (#1066 layout projects/<name>/, machines/<name>/, orch/, shared/). Tables are searched first, then the repo. The search covers the current project plus shared folders, or every project with --all. Hits are capped. Mirrored copies of a table are skipped. The session hook adds only one pointer line. --check never reads the record repo.

    🤖 Generated with Claude Code

  4. added a commit that references this issue on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions