feat(memory): path-scoped rules + project memory write-path (#-remember)#134
Merged
Conversation
Two §3.6a gaps from the audit:
Path-scoped rules: `.deepcode/rules/*.md` were dumped flat. Now each rule's
frontmatter `globs` (or `applyTo`/`paths`) is surfaced in its injected header
("rule: ts.md (applies to: src/**/*.ts)") so the model applies it only when
editing matching files, and the frontmatter fence is stripped from the body.
Agent/user memory write-path: there was a read path but nothing wrote it (the
"# to remember" help was aspirational).
- projectMemoryKey(cwd) / projectMemoryPath(home,cwd) →
~/.deepcode/projects/<slug>/memory/MEMORY.md (mirrors the harness layout).
- rememberFact(cwd, fact) appends a bullet (writes a header on first use).
- loadMemory now READS that project-memory file too (step 1b).
- REPL: a `#<text>` line remembers the fact (no agent turn) — the documented
shortcut, now real.
Tests: +2 (rule glob annotation + frontmatter strip; rememberFact → loadMemory
round-trip with single header). Core 608 green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes two §3.6a memory gaps from the audit.
Path-scoped rules —
.deepcode/rules/*.mdwere loaded flat with no scope info. Now each rule's frontmatterglobs(orapplyTo/paths) is surfaced in its injected header —# rule: ts.md (applies to: src/**/*.ts, test/**)— so the model applies it only when editing matching files, and the frontmatter fence is stripped from the body.Agent/user memory write-path — there was a read path but nothing ever wrote project memory (the "
#to remember" in/helpwas aspirational):projectMemoryKey(cwd)/projectMemoryPath(home,cwd)→~/.deepcode/projects/<slug>/memory/MEMORY.md(mirrors the harness layout).rememberFact(cwd, fact)appends a bullet (writes a header on first write).loadMemorynow reads that project-memory file too (step 1b, after user memory).#<text>line remembers the fact (no agent turn) — the documented shortcut, now real.Tests
+2 (
loader.test.ts): rule glob annotation + frontmatter strip;rememberFact→loadMemoryround-trip (both facts present, header written once). Core suite 608 green.Note
Path-scoping is annotation-based (the scope is declared + visible to the model) rather than hard filtering — a CLI agent doesn't know the "active file" at memory-load time, and globbing the whole tree per launch would be costly. This matches how an LLM-driven agent self-applies scoped rules.
🤖 Generated with Claude Code