-
Notifications
You must be signed in to change notification settings - Fork 464
feat: Claude Code hooks for automatic memory integration #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 3 commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
6190a6f
fix: Docker build and restore dashboard
russellbrenner a9d0421
feat: add Claude Code hooks and import script for OpenMemory
russellbrenner bdd04cd
fix: bash compatibility for session-start hook
russellbrenner 57716c6
feat: increase Node.js heap size for production runtime
russellbrenner 5b70729
fix: increase Node.js heap size from 128MB to 512MB
russellbrenner 30635ab
Update dashboard/.env.local.example
russellbrenner 9b0fd43
Update dashboard/app/settings/page.tsx
russellbrenner 8251980
feat: add security scanning CI and make CDN configurable
russellbrenner 7e55684
Initial plan
Copilot 98edaad
Initial plan
Copilot a0021d5
Add dev dependencies to pyproject.toml for CI
Copilot a3eb069
feat: merge upstream changes from CaviraOSS/OpenMemory
Copilot 53deb91
fix: correct query_facts_at_time parameter names in mcp.py
Copilot 2607124
Merge pull request #1 from russellbrenner/copilot/fix-ci-issues
russellbrenner 79dec06
Merge pull request #2 from russellbrenner/copilot/merge-upstream-changes
russellbrenner 6a28139
Initial plan
Copilot b83e775
Security: Fix critical vulnerabilities and add comprehensive improvem…
Copilot cffeef0
Security: Improve webhook signature verification
Copilot f67486c
docs: Add security fixes summary and validation results
Copilot 56099a4
Merge pull request #3 from russellbrenner/copilot/review-codebase-for…
russellbrenner 48d3f92
Initial plan
Copilot eb40eb4
docs: replace improvement plan with repo-grounded execution roadmap
Copilot cc52b11
docs: refine improvement plan wording after review
Copilot 3922a16
docs: add explicit parallel execution lanes to improvement roadmap
Copilot 977212d
Merge pull request #4 from russellbrenner/copilot/create-improvement-…
russellbrenner cabb943
Initial plan
Copilot e7cddb5
Phase 0: Implement security hardening (A1-A4)
Copilot 26fa6ee
Phase 0 complete: Add document features foundation (D0)
Copilot a7f96d2
Phase 1 (B1): Remove N+1 tag lookups in ranking path
Copilot 050e49c
Phase 1 (B2): Add missing database indexes for query optimization
Copilot 6bbb61b
Phase 1 (B3): Hot-path regex/vector micro-optimizations
Copilot b3e2caf
Phase 1 (B4): Add Postgres connection pool configuration
Copilot 6d22df5
Address code review feedback: Fix variable naming, logging, and add c…
Copilot 6b01d64
Add implementation summary documentation
Copilot 9d63773
Merge pull request #5 from russellbrenner/copilot/execute-implementat…
russellbrenner cf30681
Initial plan
Copilot d267ddd
feat(js): add phase-2 quick-win document metadata enrichment
Copilot b6a8442
chore(js): refine metadata extraction patterns
Copilot 2174ec3
Initial plan
Copilot 604078a
feat: add GitHub Copilot agents configuration and documentation
Copilot 6910964
Merge pull request #6 from russellbrenner/copilot/scan-repo-for-impro…
russellbrenner fabd8a7
fix: Phase 0/1 remediation - auth warnings and duplicate indexes
russellbrenner 2fdb206
feat(C3): Add background task observability
russellbrenner 3f41329
feat(D5): Add audit trail system for compliance tracking
russellbrenner c467b19
Merge pull request #7 from russellbrenner/copilot/setup-repo-for-copi…
russellbrenner e1afd85
feat(D1): Add document versioning with auto-snapshots
russellbrenner 11e9f56
feat(D4): Add redline/change classification system
russellbrenner 5998da9
feat(D2): Add citation tracking and reference graph
russellbrenner 92ea939
feat(D3): Add structured metadata extraction with zod validation
russellbrenner f4f488f
feat(D8): Add clause similarity detection
russellbrenner ddf2f32
feat(D6): Add template management with variable substitution
russellbrenner bb74c42
feat(C2,D7): Add sector parity check and compliance rules engine
russellbrenner b435056
docs: Add CLAUDE.md project guidance and D1-D8 code review
russellbrenner 88161f5
fix(D3,D7,D8): Remediate code review findings
russellbrenner 1cd5c86
fix(postgres): Use memories_table variable in all SQL queries
russellbrenner e403e4d
fix(D1-D8): Additional remediation from code review
russellbrenner aea0419
docs: Add Redis/Valkey analysis and gitignore auto-generated files
russellbrenner b898c94
feat(embeddings): Add Voyage AI provider and vector metrics
russellbrenner 07e9fbd
feat(scripts): Add re-embedding utility script
russellbrenner 80f5fb6
feat(metrics): Add Prometheus metrics with embedding cost tracking
russellbrenner 8254693
fix(dashboard): Cast last_seen_at to Number for date display
russellbrenner aaa3dba
refactor(py): OM-16 Python parity — regex hoisting + timing-safe auth
russellbrenner 0463186
feat(mcp,hsg,db): Phase 1 — deduplicated flag, upsert_key, section in…
russellbrenner 65a4b6e
refactor(hsg,extract,mcp): Phase 2 — code quality fixes
russellbrenner ef1bf1e
feat(openmemory): Phase 3 — schema, observability, stats tool (OM-9..…
russellbrenner bdbb1c8
feat(openmemory): Phase 4 — maintenance, error context, decay pinning…
russellbrenner 6f8f750
fix(db,hsg,memory): post-impl verification fixes found by e2e testing
russellbrenner 5537e0b
chore(ci): add Gitea Actions CI for openmemory-api and openmemory-das…
russellbrenner dd5e3ed
fix(hsg): sanitise raw API content blocks before memory storage
russellbrenner 90416ba
fix(hsg): allow short content through sanitise guard
russellbrenner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # OpenMemory Dashboard Configuration | ||
| NEXT_PUBLIC_API_URL=http://localhost:8080 | ||
| # Set this if your backend has OM_API_KEY configured for authentication | ||
| NEXT_PUBLIC_API_KEY=your | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| # Chat Interface Setup | ||
|
|
||
| The chat interface is now connected to the OpenMemory backend and can query memories in real-time. | ||
|
|
||
| ## Features | ||
|
|
||
| ✅ **Memory Querying**: Searches your memory database for relevant content | ||
| ✅ **Salience-based Results**: Shows top memories ranked by relevance | ||
| ✅ **Memory Reinforcement**: Click the + button to boost memory importance | ||
| ✅ **Real-time Updates**: Live connection to backend API | ||
| ✅ **Action Buttons**: Quick actions after assistant responses | ||
|
|
||
| ## Setup Instructions | ||
|
|
||
| ### 1. Start the Backend | ||
|
|
||
| First, make sure the OpenMemory backend is running: | ||
|
|
||
| ```bash | ||
| cd backend | ||
| npm install | ||
| npm run dev | ||
| ``` | ||
|
|
||
| The backend will start on `http://localhost:8080` | ||
|
|
||
| ### 2. Configure Environment (Optional) | ||
|
|
||
| The dashboard is pre-configured to connect to `localhost:8080`. If your backend runs on a different port, create a `.env.local` file: | ||
|
|
||
| ```bash | ||
| # dashboard/.env.local | ||
| NEXT_PUBLIC_API_URL=http://localhost:8080 | ||
| ``` | ||
|
|
||
| ### 3. Start the Dashboard | ||
|
|
||
| ```bash | ||
| cd dashboard | ||
| npm install | ||
| npm run dev | ||
| ``` | ||
|
|
||
| The dashboard will start on `http://localhost:3000` | ||
|
|
||
| ### 4. Add Some Memories | ||
|
|
||
| Before chatting, you need to add some memories to your database. You can do this via: | ||
|
|
||
| **Option A: API (Recommended for Testing)** | ||
|
|
||
| ```bash | ||
| curl -X POST http://localhost:8080/memory/add \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "content": "JavaScript async/await makes asynchronous code more readable", | ||
| "tags": ["javascript", "async"], | ||
| "metadata": {"source": "learning"} | ||
| }' | ||
| ``` | ||
|
|
||
| **Option B: Use the SDK** | ||
|
|
||
| ```javascript | ||
| // examples/js-sdk/basic-usage.js | ||
| import OpenMemory from '../../sdk-js/src/index.js'; | ||
|
|
||
| const om = new OpenMemory('http://localhost:8080'); | ||
|
|
||
| await om.addMemory({ | ||
| content: 'React hooks revolutionized state management', | ||
| tags: ['react', 'hooks'], | ||
| }); | ||
| ``` | ||
|
|
||
| **Option C: Ingest a Document** | ||
|
|
||
| ```bash | ||
| curl -X POST http://localhost:8080/memory/ingest \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "content_type": "text", | ||
| "data": "Your document content here...", | ||
| "metadata": {"source": "document"} | ||
| }' | ||
| ``` | ||
|
|
||
| ## How It Works | ||
|
|
||
| ### Memory Query Flow | ||
|
|
||
| 1. **User Input**: You ask a question in the chat | ||
| 2. **Backend Query**: POST to `/memory/query` with your question | ||
| 3. **Vector Search**: Backend searches HSG memory graph | ||
| 4. **Results**: Top 5 memories returned with salience scores | ||
| 5. **Response**: Chat generates answer based on retrieved memories | ||
|
|
||
| ### Memory Reinforcement | ||
|
|
||
| Clicking the **+** button on a memory card: | ||
|
|
||
| - Sends POST to `/memory/reinforce` | ||
| - Increases memory salience by 0.1 | ||
| - Makes it more likely to appear in future queries | ||
|
|
||
| ## Current Features | ||
|
|
||
| ✅ Real-time memory querying | ||
| ✅ Salience-based ranking | ||
| ✅ Memory reinforcement (boost) | ||
| ✅ Sector classification display | ||
| ✅ Error handling with backend status | ||
|
|
||
| ## Coming Soon | ||
|
|
||
| - 🚧 LLM Integration (OpenAI, Ollama, Gemini) | ||
| - 🚧 Conversation memory persistence | ||
| - 🚧 Export chat to memories | ||
| - 🚧 WebSocket streaming responses | ||
| - 🚧 Quiz generation from memories | ||
| - 🚧 Podcast script generation | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### "Failed to query memories" | ||
|
|
||
| - Ensure backend is running: `npm run dev` in `backend/` | ||
| - Check backend is on port 8080: `curl http://localhost:8080/health` | ||
| - Verify CORS is enabled (already configured) | ||
|
|
||
| ### "No memories found" | ||
|
|
||
| - Add memories using the API or SDK (see setup above) | ||
| - Try broader search terms | ||
| - Check memory content exists: `GET http://localhost:8080/memory/all` | ||
|
|
||
| ### Connection refused | ||
|
|
||
| - Backend not started | ||
| - Wrong port in `.env.local` | ||
| - Firewall blocking connection | ||
|
|
||
| ## API Endpoints Used | ||
|
|
||
| ```typescript | ||
| POST /memory/query // Search memories | ||
| POST /memory/add // Add new memory | ||
| POST /memory/reinforce // Boost memory salience | ||
| GET /memory/all // List all memories | ||
| GET /memory/:id // Get specific memory | ||
| ``` | ||
|
|
||
| ## Next Steps | ||
|
|
||
| 1. Add LLM integration for intelligent responses | ||
| 2. Implement conversation memory storage | ||
| 3. Add streaming response support | ||
| 4. Create memory export feature | ||
| 5. Build quiz/podcast generators |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). | ||
|
|
||
| ## Getting Started | ||
|
|
||
| First, run the development server: | ||
|
|
||
| ```bash | ||
| npm run dev | ||
| # or | ||
| yarn dev | ||
| # or | ||
| pnpm dev | ||
| # or | ||
| bun dev | ||
| ``` | ||
|
|
||
| Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
|
||
| You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. | ||
|
|
||
| This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. | ||
|
|
||
| ## Learn More | ||
|
|
||
| To learn more about Next.js, take a look at the following resources: | ||
|
|
||
| - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
| - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
|
||
| You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! | ||
|
|
||
| ## Deploy on Vercel | ||
|
|
||
| The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
|
|
||
| Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| import { NextResponse } from 'next/server' | ||
| import fs from 'fs' | ||
| import path from 'path' | ||
|
|
||
| const ENV_PATH = path.resolve(process.cwd(), '../.env') | ||
|
|
||
| function parseEnvFile(content: string): Record<string, string> { | ||
| const result: Record<string, string> = {} | ||
| const lines = content.split('\n') | ||
|
|
||
| for (const line of lines) { | ||
| const trimmed = line.trim() | ||
| if (!trimmed || trimmed.startsWith('#')) continue | ||
|
|
||
| const equalIndex = trimmed.indexOf('=') | ||
| if (equalIndex === -1) continue | ||
|
|
||
| const key = trimmed.substring(0, equalIndex).trim() | ||
| const value = trimmed.substring(equalIndex + 1).trim() | ||
| result[key] = value | ||
| } | ||
|
|
||
| return result | ||
| } | ||
|
|
||
| function serializeEnvFile(updates: Record<string, string>): string { | ||
| const lines: string[] = [] | ||
|
|
||
| for (const [key, value] of Object.entries(updates)) { | ||
| lines.push(`${key}=${value}`) | ||
| } | ||
|
|
||
| return lines.join('\n') | ||
| } | ||
|
|
||
| export async function GET() { | ||
| try { | ||
| if (!fs.existsSync(ENV_PATH)) { | ||
| return NextResponse.json({ | ||
| exists: false, | ||
| settings: {} | ||
| }) | ||
| } | ||
|
|
||
| const content = fs.readFileSync(ENV_PATH, 'utf-8') | ||
| const settings = parseEnvFile(content) | ||
|
|
||
| const masked = { ...settings } | ||
| if (masked.OPENAI_API_KEY) masked.OPENAI_API_KEY = '***' | ||
| if (masked.GEMINI_API_KEY) masked.GEMINI_API_KEY = '***' | ||
| if (masked.AWS_SECRET_ACCESS_KEY) masked.AWS_SECRET_ACCESS_KEY = "***" | ||
| if (masked.OM_API_KEY) masked.OM_API_KEY = '***' | ||
|
|
||
| return NextResponse.json({ | ||
| exists: true, | ||
| settings: masked | ||
| }) | ||
| } catch (e: any) { | ||
| console.error('[Settings API] read error:', e) | ||
| return NextResponse.json( | ||
| { error: 'internal', message: e.message }, | ||
| { status: 500 } | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| export async function POST(request: Request) { | ||
| try { | ||
| const updates = await request.json() | ||
|
|
||
| if (!updates || typeof updates !== 'object') { | ||
| return NextResponse.json( | ||
| { error: 'invalid_body' }, | ||
| { status: 400 } | ||
| ) | ||
| } | ||
|
|
||
| let content = '' | ||
| let envExists = false | ||
|
|
||
| if (fs.existsSync(ENV_PATH)) { | ||
| content = fs.readFileSync(ENV_PATH, 'utf-8') | ||
| envExists = true | ||
| } else { | ||
| const examplePath = path.resolve(process.cwd(), '../.env.example') | ||
| if (fs.existsSync(examplePath)) { | ||
| content = fs.readFileSync(examplePath, 'utf-8') | ||
| } | ||
| } | ||
|
|
||
| const existing = content ? parseEnvFile(content) : {} | ||
| const merged = { ...existing, ...updates } | ||
| const newContent = serializeEnvFile(merged) | ||
|
|
||
| fs.writeFileSync(ENV_PATH, newContent, 'utf-8') | ||
|
|
||
| return NextResponse.json({ | ||
| ok: true, | ||
| created: !envExists, | ||
| message: 'Settings saved. Restart the backend to apply changes.' | ||
| }) | ||
| } catch (e: any) { | ||
| console.error('[Settings API] write error:', e) | ||
| return NextResponse.json( | ||
| { error: 'internal', message: e.message }, | ||
| { status: 500 } | ||
| ) | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.