Skip to content

Local agent: latency, context isolation, reliable lists - #93

Merged
arthware-dev merged 10 commits into
mainfrom
feature/local-agent-improvements
Sep 15, 2026
Merged

arthware-dev merged 10 commits into
mainfrom
feature/local-agent-improvements

Conversation

@arthware-dev

Copy link
Copy Markdown
Contributor

Fixes the local chat agent's 3-5 minute responses, context bleed between
threads, and unreliable list editing. All validated in an isolated rig
(real agent image, demo vault, logging proxy to oMLX); see
docs/design/agent/review-2026-09.md and agent-improvement-log.md.

Latency

Simple grounded questions dropped from 42-60 s to ~17-24 s, warm TTFT from
~10 s to ~2-4 s.

  • Removed a hidden second LLM call inside every search (the --nl keyword
    rewrite); the model supplies keywords, joined as an OR-regex.
  • One documented retrieval route; token-lean pseudocode skill (~11.3K to
    ~8.2K prefix).
  • zz-cache-pad skill aligns the prefix just past oMLX's 4096-token cache
    block boundary (measured: misalignment doubles per-call prefill).
  • Dropped 6 unused nanobot tool schemas; batched memory_search.

Context isolation

  • Thread-scoped session keys, so threads and speakers stop sharing a room
    transcript. max_messages cap for long threads.

Lists

  • New stack memory list-edit verb: add/tick/untick/remove/clear-done/reset,
    one or more items per call, one commit; the store matches items and
    refuses ambiguity instead of guessing.
  • Write-seam guards reject writes that break frontmatter or silently reopen/
    remove list items.
  • Edit verbs return the touched page's wiki link for grounded Sources.

Tooling

  • tools/agent-lab/: endpoint lab + end-to-end rig for measuring agent
    latency and context in isolation (synthetic data only).

Env kill switches on each behavior change (AGENT_LEAN_STATE,
AGENT_TOOL_TRIM, AGENT_THREAD_SESSIONS). Not yet tested on live Matrix.

Endpoint lab (probe/cache/replay) measures oMLX prefix-cache behavior
with synthetic prompts. The rig runs the real agent image against a
demo vault, a lab famstack-api, and a logging proxy that records the
byte-exact context per LLM call. Review and measurement log included.

- lab.py: TTFT/usage measurement, deterministic prompts
- rig: nanobot agent turns without Matrix, fabricated demo data only
- findings: 4096-token cache blocks, 430-460 tok/s prefill, 11.2K prefix
Measured in the agent-lab rig: simple questions dropped from 42-60 s
to 23-24 s, warm TTFT from ~10 s to ~4 s, all replies still correct.

- config.json: disable unused nanobot builtin skills (memory, my)
- entrypoint.sh: seed minimal USER.md, replaces the ~1K-char template
- AGENTS.md, SKILL.md: token-lean rewrite; brief-pointer-first and
  one-search rule; prefix 11,281 -> 9,184 tokens
- memory_tool.py: build an OR-regex from model keywords; removes the
  --nl rewrite, a second LLM call inside every multi-word search
- sitecustomize.py: AGENT_LEAN_STATE=0 switch for append-only A/B
Store matches the named item, changes one line, refuses ambiguity.
Allowlisted for the agent; 8 module tests.
…kill

Thread-scoped session keys, 6 unused tool schemas dropped, batched
memory_search, cache-pad alignment, max_messages 40.
Bulk clear/reset in one call; edit verbs return the touched page's
/go link for the reply's Sources. German rig run green.
Single items[] param, one commit, changed and missed items reported
together. Rig runs the production transform. Validated end-to-end.
Stub gains ArraySchema, tools.registry, real _handle_message signature.
Removal-via-write now refused (goes through list_edit).
@arthware-dev
arthware-dev merged commit 82c94b2 into main Sep 15, 2026
1 check passed
@arthware-dev
arthware-dev deleted the feature/local-agent-improvements branch September 22, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant