Skip to content

feat: context repositories — git-backed memory system#6

Merged
ByteMirror merged 4 commits intomainfrom
fabian.urbanek/memory
Feb 24, 2026
Merged

feat: context repositories — git-backed memory system#6
ByteMirror merged 4 commits intomainfrom
fabian.urbanek/memory

Conversation

@ByteMirror
Copy link
Copy Markdown
Owner

Summary

Implements "Context Repositories" for the Hivemind memory system: a git-backed filesystem with YAML frontmatter, system/ always-in-context files, and subagent-based maintenance skills.

  • Frontmatter: YAML metadata (description, read-only) on memory files, parsed/stripped transparently
  • Git versioning: Auto-commits on every memory write/move/delete; full git log history per file
  • File tree: Compact ASCII tree with descriptions injected into CLAUDE.md at agent startup
  • System files: system/ directory for always-in-context files; global.md auto-migrated on first run
  • Expanded MCP tools: 11 tools (was 4) + 3 subagent skills — memory_read, memory_tree, memory_history, memory_append, memory_move, memory_delete, memory_pin, memory_unpin, memory_init, memory_reflect, memory_defrag
  • Enhanced injection: CLAUDE.md now includes file tree, full system/ contents (budget-capped), and expanded tool table
  • Recursive operations: List() and watcher now traverse subdirectories, skip .git/ and .index/
  • Config: Added git_enabled and system_budget_chars to MemoryConfig

New files

File Purpose
memory/frontmatter.go YAML frontmatter parse/format
memory/git.go Git repo init, auto-commit, log
memory/tree.go File tree with descriptions
mcp/memory_skills.go Subagent memory_init/reflect/defrag

Backward compatibility

  • Files without frontmatter work identically
  • memory_write without path = append to daily file (existing behavior)
  • memory_search/memory_list keep same names and params
  • Git is non-fatal everywhere — gitRepo == nil means all git ops are no-ops

Test plan

  • go build ./... — compiles clean
  • go vet ./... — no issues
  • go test ./... — all 16 packages pass (0 failures)
  • Existing manager, MCP, session, and UI tests still pass
  • Manual: verify CLAUDE.md contains file tree + system/ contents on agent start
  • Manual: call memory_pin, memory_tree, memory_history from agent

- Call instanceChanged() after creating chat agent so tabbedWindow
  enters chat mode and clears stale content
- Add defer recover() in startCmd to prevent process crashes
- Add debug logging throughout createChatAgent and instanceChanged
  to diagnose remaining panic
- Fix sidebar chat tab to not show code topics
- Add log import to app_state.go
… tab

- Set started=true for chat agents in FromInstanceData so they survive
  SaveInstances() calls after reload
- Add chat agent early-return in Resume() delegating to startChatAgent()
- Skip code topics in multi-repo sidebar when Chat tab is active
- Inject companion personality into CLAUDE.md for all agent types
- Fix linter-introduced undefined InjectMemoryContext/GetOrCreateRepoManager
- Guard UpdateDiffStats against nil gitWorktree for chat agents
- Clean up debug logging from crash investigation
…te, revamp memory browser UI

- Add Sync() calls after global.md → system/global.md rename to keep search index consistent
- memory_write with scope="global" now writes to system/global.md instead of being ignored
- Memory browser now uses Manager methods (Read/WriteFile/Delete) instead of raw os calls
- Browser shows frontmatter descriptions, system file pin indicators, and pin/unpin keybindings
- Rebuild hivemind-mcp binary with all 11 memory tools + 3 memory skills
- Update server instructions and CLAUDE.md injection to reference system/global.md
@ByteMirror ByteMirror merged commit 20ff597 into main Feb 24, 2026
5 of 6 checks 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