Conversation
Documented REST gateway for non-MCP clients providing 20 endpoints covering search, capture, CRUD, stats, ingest proxy, duplicate resolution, and knowledge graph entity browsing with CORS support. Ported from ExoCortex open-brain-rest with OB1 adaptations: OpenRouter-first provider order, wildcard CORS, thoughts table (not brain_thoughts), removed applyEvergreenTag dependency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4046b5fce3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
integrations/rest-api/index.ts
Outdated
| const thoughtMatch = path.match(/^\/thought\/(\d+)$/); | ||
| if (thoughtMatch) { | ||
| const id = Number(thoughtMatch[1]); |
There was a problem hiding this comment.
Accept UUID thought IDs in route matching
The thought routes currently only match numeric IDs (/^(\\d+)$/), but this repository’s default schema uses UUID thought IDs (docs/01-getting-started.md shows thoughts.id uuid, and schemas/enhanced-thoughts/schema.sql defines get_thought_connections(p_thought_id UUID)). With the current regex and Number(...) coercion, valid UUID URLs like /thought/<uuid> never match and these endpoints return 404 instead of operating on existing thoughts.
Useful? React with 👍 / 👎.
integrations/rest-api/index.ts
Outdated
| const result = data as { thought_id: number; action: string; content_fingerprint: string } | null; | ||
| if (!result?.thought_id) throw new Error("upsert_thought returned no result"); |
There was a problem hiding this comment.
Parse upsert_thought response using returned id field
The capture handler assumes upsert_thought returns { thought_id, action, content_fingerprint }, then throws when thought_id is missing. In this repo’s documented setup, upsert_thought returns JSON with id (see docs/01-getting-started.md), and existing server code reads upsertResult?.id; with that standard function, /capture will fail with upsert_thought returned no result even when insert/update succeeded.
Useful? React with 👍 / 👎.
| const filter: Record<string, unknown> = {}; | ||
| if (excludeRestricted) filter.exclude_restricted = true; | ||
| const { data, error } = await supabase.rpc("search_thoughts_text", { | ||
| p_query: query, p_limit: limit, p_filter: filter, p_offset: offset, |
There was a problem hiding this comment.
Remove exclude flag from metadata filter in text search
In text mode, exclude_restricted is encoded as p_filter.exclude_restricted, but search_thoughts_text applies p_filter as t.metadata @> p_filter (see schemas/enhanced-thoughts/schema.sql) and does not interpret that key as a sensitivity predicate. This means default requests (exclude_restricted true) effectively require each thought’s metadata to contain { "exclude_restricted": true }, causing most text searches to return empty results rather than excluding restricted rows.
Useful? React with 👍 / 👎.
Add blank lines around headings (MD022), fenced code blocks (MD031), and between adjacent blockquotes (MD028). Fix broken link fragment (MD051) and remove extra blank line (MD012). No content changes. These errors were blocking CI on all open PRs since the lint check runs repo-wide. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each section's numbered list now restarts at 1 instead of continuing the global count (3-14), satisfying markdownlint MD029/ol-prefix rule. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… variants
JavaScript Number loses precision beyond 2^53. All ID parsing now uses
string validation instead of Number(). Added extractThoughtId() to
handle all upsert_thought RPC response shapes (scalar, {id}, {thought_id}).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Key Features
*for browser and Electron clients/ingestand/ingestion-jobsendpoints proxy to the smart-ingest function/entitiesendpoints query the graph (optional, requires schema)Files
index.ts_shared/helpers.ts_shared/config.tsREADME.mdmetadata.jsondeno.jsonTest plan
/healthendpoint/search(semantic + text modes)/capturewith and withoutskip_classification/thought/:id/statsendpoint🤖 Generated with Claude Code