Skip to content

LOU-W4, LOU-W7: sessions for createAgent; AGENTS.md auto-loading - #59

Merged
LinuxDevil merged 2 commits into
mainfrom
lou-w4-w7-sessions-and-agents-md
Oct 1, 2026
Merged

LinuxDevil merged 2 commits into
mainfrom
lou-w4-w7-sessions-and-agents-md

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

What

  • LOU-W4: agent.session({ id?, store? }) returns an AgentSession (id, send(input, { signal }), messages, load(), clear()). SessionStore interface with MemorySessionStore (default) and FileSessionStore(dir) (one JSON file per session, temp file + rename, id must match ^[A-Za-z0-9_-]{1,128}$).
  • LOU-W7: loadProjectInstructions({ cwd?, files?, stopAt?, maxChars? }) (exported from the root) and opt-in createAgent({ projectInstructions: true | { cwd, files } }), appended under ## Project instructions (from AGENTS.md).
  • Docs: new docs/sessions.md, "Project instructions" section in docs/configuration.md, README bullets + session snippet, regenerated llms.txt/llms-full.txt.

Why

send() was single-turn, and nothing gave users multi-turn memory or the repo's own AGENTS.md. Both are opt-in additions.

How

  • Sessions are a thin layer: the session owns the transcript and passes [...history, user] as the existing input: Message[] of AgentExecutor.execute, then stores result.messages minus the system message. No executor change; no checkpoint/resume use (LOU-U8 untouched).
  • Sends are serialized with a promise queue. A throwing or aborted send leaves the transcript unchanged; saved transcripts are trimmed to a provider-valid prefix (no assistant tool-call turn without all its results).
  • createAgent.ts edits are additive: the executor call is pulled into a local run helper that send and sessions share.

How verified

Run on the result of merging origin/main at b5cd5f5 (LOU-X6):

  • npx tsc --noEmit: clean
  • npm run lint: 0 errors (433 warnings, none in new files)
  • build + create-loushy-agent build: success
  • npm run test:coverage: Test Files 115 passed; Tests 1625 passed, 4 skipped
  • npm run fallow: exit 0
  • npm run test:types: no errors
  • npm run docs:verify-snippets: all 56 snippets type-check against src/; 6 also run cleanly
  • npm run docs:llms:check: exit 0

Notes for reviewer

  • The class is named AgentSession because Session is already exported from src/data/models.ts.
  • agent.stream does not exist on main yet, so session.stream() is not added; add it when agent.stream lands.
  • loadProjectInstructions is synchronous (it runs once inside the sync createAgent). Empty/whitespace-only files are skipped.
  • session.messages is empty for a resumed session until load() or the first send() completes.

🤖 Generated with Claude Code

LinuxDevil and others added 2 commits October 1, 2026 10:11
W4: agent.session() returns an AgentSession that owns the transcript and
passes it to the executor on each send (no checkpoint/resume involved).
MemorySessionStore (default) and FileSessionStore (atomic write, id
validation). Sends are serialized; failed or aborted sends leave the
transcript unchanged; stored transcripts are trimmed to a provider-valid
prefix.

W7: loadProjectInstructions() walks up to .git/stopAt and returns the nearest
AGENTS.md/CLAUDE.md (size-capped); createAgent({ projectInstructions }) is an
opt-in that appends it under a heading.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@LinuxDevil
LinuxDevil merged commit e4582d9 into main Oct 1, 2026
1 check passed
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