Skip to content

Bug: harvest can never produce 'context' memories (type missing from valid set) #30

@raphasouthall

Description

@raphasouthall

Summary

`context` is a supported memory type (has a TTL-168h branch in `harvest.py:753`) but the harvester's LLM classifier rejects it. All 13 context memories in the current vault are hand-written via `vault_remember`. This partially explains the skewed type distribution: 38% observation vs 2% context.

Root cause

`src/neurostack/harvest.py:647` — `_llm_classify` valid set:

```python
{"bug", "decision", "convention", "learning", "observation"}
```

`context` is missing. The LLM prompt at `harvest.py:600-604` also omits it. So even if the LLM tried to emit `context`, the classifier would reject it.

Downstream: the TTL-168h branch at `harvest.py:753` is unreachable from harvest — dead code until this is fixed.

Proposed fix

  1. Add `"context"` to the valid set at `harvest.py:647`.
  2. Extend the prompt at `harvest.py:600-604` to define context: ephemeral state, credentials, URLs, or session-scoped facts with a short TTL.
  3. While there: the observation prefilter at `harvest.py:488-492` over-captures (matches generic terms: credential, api-key, endpoint, host, port, url, stored at). Consider routing `credential`-pattern matches to `context` (short TTL) rather than permanent `observation`.

Expected effect

Unblocks the TTL-168h path. Starts populating the context bucket from sessions. Reduces observation noise by routing ephemeral facts to their intended bucket.

Key files

  • `src/neurostack/harvest.py:488-493, 600-605, 647, 753`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions