feat: Step 6 - Write-through cache API
Implement the core write-through cache pattern for node creation. This is the architectural foundation of the application. Changes: - Add @google/generative-ai dependency for embeddings - Create lib/db.ts: SurrealDB connection helper with JWT auth - Create lib/ai.ts: AI embedding generation using text-embedding-004 - Create app/api/nodes/route.ts: POST endpoint implementing write-through cache Write-through cache flow: 1. Authenticate user via SurrealDB JWT 2. Publish node to ATproto PDS (source of truth) 3. Generate 768-dimensional embedding via Google AI 4. Cache node + embedding + links in SurrealDB Updated schema to use 768-dimensional embeddings (text-embedding-004) instead of 1536 dimensions. Security: - Row-level permissions enforced via SurrealDB JWT - All secrets server-side only - ATproto OAuth tokens from secure cookies 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
12
AGENTS.md
12
AGENTS.md
@@ -3,6 +3,8 @@
|
||||
This document outlines the standards and practices for the development of the
|
||||
Ponderants application. The AI agent must adhere to these guidelines strictly.
|
||||
|
||||
**Git Commits**: For this project, you can skip PGP-signed commits and run git commands directly. You have permission to execute git add, git commit, and git push commands yourself.
|
||||
|
||||
You are an expert-level, full-stack AI coding agent. Your task is to implement
|
||||
the "Ponderants" application. Product Vision: Ponderants is an AI-powered
|
||||
thought partner that interviews a user to capture, structure, and visualize
|
||||
@@ -61,6 +63,11 @@ on clean, expert-level implementation adhering to the specified architecture.
|
||||
access their own data.
|
||||
- **Secrets Management:** Store all API keys and secrets in environment
|
||||
variables.
|
||||
- **Environment Variables:** NEVER set default values in code for configuration
|
||||
variables. All configuration must come from .env file. Code should throw
|
||||
an error with a clear message if required environment variables are missing.
|
||||
This ensures configuration issues are caught immediately rather than silently
|
||||
falling back to potentially incorrect defaults.
|
||||
- **Input Validation:** Validate all inputs on the server side (e.g., using
|
||||
Zod).
|
||||
|
||||
@@ -231,3 +238,8 @@ You, the AI Agent, MUST adhere to the following principles at all times. These a
|
||||
### **Aesthetic Goal**
|
||||
|
||||
The user has demanded a "stunningly-beautiful" application. You will achieve this not with complex, custom CSS, but with the thoughtful and elegant use of Mantine's layout components (\<Stack\>, \<Group\>, \<Paper\>, \<AppShell\>), a sophisticated grayscale theme.ts, and fluid interactions. The 3D visualization, powered by React Three Fiber, must be smooth, interactive, and beautiful.
|
||||
|
||||
### MCP Servers
|
||||
|
||||
You have access to SurrealDB and playwright MCP servers -- use them readily to
|
||||
help debug any issues you may encounter!
|
||||
|
||||
Reference in New Issue
Block a user