Skip to content

feat(retrieval): manifest-first bounded knapsack retrieval to reduce context consumption #41

Description

@harshsinghmp

Classification

actionable-feature

Context & Rationale

Injecting full memory notes into agent prompts burns significant context tokens and risks hallucinations. Inspired by Secretary's bounded retrieval, injecting a compact manifest allows agents to select only what is needed.

Key Capabilities & Scope

  1. Manifest-First Injection:
    • Instead of injecting full note bodies on session start, inject a compact JSON/YAML manifest (id, hash, title, tags, one_line_summary).
  2. On-Demand Hydration:
    • Provide a fast tool or CLI flag to hydrate and read the full note only when selected.
  3. Knapsack Optimization:
    • Bound total injected manifest size to a strict token budget (<500 tokens).

Verification Criteria

  • Knapsack retrieval returns manifest summaries by default.
  • Specific entries can be hydrated on demand.
  • Passes test suite (bun test test/).

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions