feat: persistent memory, moderation, token budgets, and model-driven maps #16

Merged
Jc-965 merged 26 commits from memory-moderation-optimization into main 2026-08-13 17:45:29 +00:00
Member

Summary

Combines the three open feature branches into one change (supersedes #13, #14, #15).

  • Adds persistent per-user memory on pgvector with remember and forget tools, multi-fact forgetting with a confirmation flow for ambiguous requests, recall injected as conversation context, background fact learning after each turn, and REST endpoints for listing, deleting, and clearing a user's memories
  • Screens every incoming message and finished reply through OpenAI's free moderation endpoint, returning CaPS/988 campus resources for self-harm signals and a brief refusal for other flagged categories, with flagged replies redacted retroactively in the done payload
  • Adds one-time chat title generation from a chat's first message on a flash-class model with reasoning disabled, titling flagged messages "New chat"
  • Lets the model decide the campus map by calling a local maps_show_map tool, validated deterministically against the building catalog with query inference as the fallback, and scrubs false lookup-failure claims from map answers
  • Detects MCP tool failures structurally from the tool message status instead of matching result text, and hides transport errors from the model
  • Enforces per-user daily token budgets returning 429 when exhausted, records measured usage per model pass, narrows bound tools to the query, condenses tool descriptions, compacts the system prompt, caches MCP tool discovery, and caps history and tool-result sizes
  • Rejects oversized request bodies by header and answers flagrant injection phrasing with a canned refusal before any tokens are spent
## Summary Combines the three open feature branches into one change (supersedes #13, #14, #15). - Adds persistent per-user memory on pgvector with remember and forget tools, multi-fact forgetting with a confirmation flow for ambiguous requests, recall injected as conversation context, background fact learning after each turn, and REST endpoints for listing, deleting, and clearing a user's memories - Screens every incoming message and finished reply through OpenAI's free moderation endpoint, returning CaPS/988 campus resources for self-harm signals and a brief refusal for other flagged categories, with flagged replies redacted retroactively in the done payload - Adds one-time chat title generation from a chat's first message on a flash-class model with reasoning disabled, titling flagged messages "New chat" - Lets the model decide the campus map by calling a local maps_show_map tool, validated deterministically against the building catalog with query inference as the fallback, and scrubs false lookup-failure claims from map answers - Detects MCP tool failures structurally from the tool message status instead of matching result text, and hides transport errors from the model - Enforces per-user daily token budgets returning 429 when exhausted, records measured usage per model pass, narrows bound tools to the query, condenses tool descriptions, compacts the system prompt, caches MCP tool discovery, and caps history and tool-result sizes - Rejects oversized request bodies by header and answers flagrant injection phrasing with a canned refusal before any tokens are spent
docs: improve comments for persistent memory
Some checks failed
CI / build (pull_request) Failing after 10s
CI / check-1 (pull_request) Failing after 12s
CI / check (pull_request) Failing after 0s
CI / test-agent (pull_request) Has been skipped
kennel/build build succeeded
kennel/deploy deployment healthy
8074ca92bc
feat: make memory forgetting more robust
Some checks failed
kennel/build build succeeded
kennel/deploy deployment healthy
CI / build (pull_request) Failing after 12s
CI / check-1 (pull_request) Failing after 13s
CI / check (pull_request) Failing after 0s
CI / test-agent (pull_request) Has been skipped
7e390baac4
feat: add chat title generation endpoint
Some checks failed
CI / build (pull_request) Failing after 10s
CI / check-1 (pull_request) Failing after 12s
CI / check (pull_request) Failing after 0s
CI / test-agent (pull_request) Has been skipped
kennel/build build succeeded
kennel/deploy deployment healthy
13dba7a277
feat: moderate user messages and agent replies
Some checks failed
CI / build (pull_request) Failing after 10s
CI / check-1 (pull_request) Failing after 11s
CI / check (pull_request) Failing after 0s
CI / test-agent (pull_request) Has been skipped
kennel/build build succeeded
kennel/deploy deployment healthy
27dc1c6122
Merge remote-tracking branch 'origin/optimization-token-limit' into persistent-user-memory
Some checks failed
CI / build (pull_request) Failing after 16s
CI / check-1 (pull_request) Failing after 18s
CI / check (pull_request) Failing after 0s
CI / test-agent (pull_request) Has been skipped
kennel/build build succeeded
kennel/deploy deployment healthy
2ee505d85d

Kennel Deployments

Torn down at 2026-08-13 17:45:31 UTC.

<!-- kennel-deployment --> ### Kennel Deployments Torn down at 2026-08-13 17:45:31 UTC.
fix: replace non-ascii chars and tighten score type for ci
Some checks failed
kennel/deploy deployment healthy
kennel/build build succeeded
CI / build (pull_request) Failing after 36s
CI / check-1 (pull_request) Failing after 41s
CI / check (pull_request) Failing after 0s
CI / test-agent (pull_request) Has been skipped
a89da3ea47
Merge remote-tracking branch 'origin/main' into memory-moderation-optimization
Some checks failed
kennel/build build succeeded
kennel/deploy deployment healthy
CI / check-1 (pull_request) Failing after 3m8s
CI / build (pull_request) Successful in 3m22s
CI / check (pull_request) Failing after 0s
CI / test-agent (pull_request) Has been skipped
a7a2dff537
chore: drop unused ty ignore comments in map tool
Some checks failed
kennel/build build succeeded
kennel/deploy deployment healthy
CI / build (pull_request) Successful in 1m29s
CI / check-1 (pull_request) Successful in 1m40s
CI / check (pull_request) Successful in 0s
CI / test-agent (pull_request) Failing after 52s
11436b5368
fix: keep memory ci tests offline
Some checks failed
kennel/build build succeeded
CI / check-1 (pull_request) Failing after 1m58s
CI / check (pull_request) Failing after 0s
CI / test-agent (pull_request) Has been skipped
kennel/deploy deployment healthy
CI / build (pull_request) Successful in 2m8s
7e8a59754e
fix: keep memory ci tests offline and update map prompt
All checks were successful
kennel/build build succeeded
kennel/deploy deployment healthy
CI / build (pull_request) Successful in 1m28s
CI / check-1 (pull_request) Successful in 1m38s
CI / check (pull_request) Successful in 0s
CI / test-agent (pull_request) Successful in 48s
b8783a8689
Jc-965 merged commit 7114603d5e into main 2026-08-13 17:45:29 +00:00
Sign in to join this conversation.
No description provided.