Requirements
- Bun - Required to build from source
- macOS (Apple Silicon or Intel) or Linux (x64 / ARM64)
- Claude Code or OpenCode installed (for testing)
Quick Start
Clone the repository and install dependencies:Build Commands
Build All Components
dist/daemon.js- Main daemon serverdist/mcp.js- MCP serverdist/hooks/post-tool.js- Post-tool hookdist/hooks/prompt.js- Prompt hookdist/hooks/stop.js- Stop hookdist/install.js- Installer scriptdist/uninstall.js- Uninstaller script
Build OpenCode Plugin
dist/plugin.js
Build Binaries
Build platform-specific binaries:dist/bin/:
longmem-linux-arm64longmem-linux-x64longmem-macos-arm64longmem-macos-x64longmem-windows-x64.exe
Development Commands
Run Daemon in Development Mode
Run Tests
tests/
Install from Source
Project Structure
Key Directories
daemon/ - Core server that stores observations, handles compression, and serves the API
cli/ - Command-line interface for controlling the daemon (longmem start, longmem stop, etc.)
hooks/ - Integration hooks that capture prompts and tool outputs from Claude Code/OpenCode
mcp/ - Model Context Protocol server that provides memory tools to the LLM
opencode/ - OpenCode-specific plugin integration
shared/ - Shared utilities for configuration, detection, and system integration
Configuration
Development configuration is stored in~/.longmem/settings.json:
Testing Your Changes
-
Build the project:
-
Install locally:
-
Start the daemon:
- Test with Claude Code or OpenCode: Start a new session and verify that prompts and tool outputs are captured.
-
Check the database:
Contributing
Pull Requests
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and test thoroughly
- Run tests:
bun test - Build:
bun run build - Commit with clear messages
- Push to your fork
- Open a pull request on GitHub
Code Style
- Use TypeScript for all new code
- Follow existing naming conventions
- Add comments for complex logic
- Keep functions focused and modular
Testing
All new features should include tests in thetests/ directory:
Debugging
Enable Verbose Logging
Editdaemon/server.ts to add debug logging:
Inspect Database
Monitor HTTP Traffic
Release Process
- Update version in
package.json - Build all binaries:
bun run build:binaries - Test on all platforms
- Tag release:
git tag v1.0.0 - Push tag:
git push origin v1.0.0 - GitHub Actions will create the release automatically