Skip to content

Phase0 contract stabilization#39

Open
dporkka wants to merge 18 commits into
mainfrom
phase0-contract-stabilization
Open

Phase0 contract stabilization#39
dporkka wants to merge 18 commits into
mainfrom
phase0-contract-stabilization

Conversation

@dporkka

@dporkka dporkka commented Jul 10, 2026

Copy link
Copy Markdown
Owner

No description provided.

dporkka and others added 18 commits June 10, 2026 07:18
Finish the contract-stabilization work so the local HTTP API matches what
the web, extension, and mobile clients actually consume.

- GET /projects now returns a bare JSON string[] (was {projects:[...]}),
  matching all three clients and the other list endpoints (/search,
  /recent, /stale). Empty result serializes to [] not null.
- GET /git/status now reports real vault state via internal/git.Status
  (branch, clean, ahead/behind, modified and untracked files) and
  truthfully returns isGitRepo:false for non-versioned vaults, replacing
  the hard-coded clean-main payload.
- Wire source navigation: add ID to rag.Source (from the search result),
  surface it in the web Source type, and navigate AskPanel sources by
  /note/{id} instead of /note/{path}, which 404'd now that /ask returns
  real sources.

Tests assert the bare /projects array, both repo and non-repo /git/status
paths, and that /ask sources carry id + path. Docs updated to mark Phase 0
complete.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tecture, quality

P0 Security fixes:
- Fix YAML injection in capture handler (quote user-supplied fields)
- Fix path traversal in note-by-path handler (validate with filepath.Clean)
- Fix race condition in capture file numbering (atomic O_CREATE|O_EXCL)
- Fix ~10 silently ignored errors across api, mcp, and search packages
- Replace predictable auth token fallback with panic on crypto/rand failure

P1 Architecture improvements:
- Consolidate ~500 lines of duplicated AI provider HTTP logic into shared httpClient
- Reuse http.Client in HealthCheck instead of creating new client each call
- Add embedClient field to Searcher instead of hardcoding Ollama defaults
- Rename rebuildFTS to clearFTS (accurate name for delete-only behavior)
- Eliminate CWD-dependent migration paths (use inline schema as primary)
- Add authentication to MCP HTTP endpoint
- Cache AI provider on Server struct with lazy initialization
- Consolidate duplicated parseAnswer into exported rag.ParseAnswer()
- Consolidate folderForType/noteTypeToFolder into templates package
- Add connection pool config and slow query logging to DB wrapper
- Use context.WithCancel in MCP ServeStdio
- Log partial failures in HybridSearch

P2 Quality improvements:
- Add recover() panic handler to writeJSON
- Improve token count heuristic (bytes vs runes)
- Handle HTML entities in stripHTMLTags
- Add token bucket rate limiter to API
- Preserve Unicode in sanitizeFilename
- Return empty slice instead of nil in git.Log
- Add cleanupDeletedFiles to remove orphaned DB entries
- Add AIStreamProvider interface for streaming support
- Use shared config.Load in indexer buildEmbedConfig
- Fix defer resp.Body.Close placement in embeddings
- Add TODO for Ollama batch endpoint
- Return relative paths in ParseFilesInDir
Phase 0+ — consolidate the HTTP API contract into a single source on both
sides of the boundary so the Go server, the Wails desktop bridge, and the
web/extension/mobile/desktop TypeScript clients never drift.

Shared contract:
- core/internal/contract: canonical Go types (SearchResult, NoteDetail,
  IndexResult, IndexError, Answer, Source, VaultStatus, GitStatus,
  GitModifiedFile) with the camelCase JSON tags the API emits. Imported by
  api, search, indexer, rag, and the desktop Go bridge.
- packages/contract: zero-dependency TypeScript twin — types, a typed route
  table, and a portable createClient HTTP client with pluggable token
  storage. Consumed by web-local, browser-extension, mobile-expo, and the
  desktop frontend via tsconfig path mappings (+ Metro watchFolders for
  mobile, + vite resolve.alias for the web apps).
- Remove apps/web-local/src/api/types.ts and the per-client hand-written
  duplicates; clients now re-export from @agentvault/contract.
- make contract-check CI gate + scripts/contract-snake-list.sh guard against
  future drift (snake_case keys, hard-coded base URLs, non-shared types).

Completeness fixes (the in-progress tree had failing tests and a broken gate):
- Consolidate note→folder resolution into templates.FolderRelForType /
  FolderPathForType as the single source. CLI, HTTP API, MCP, and desktop
  all route through it, removing three divergent folderForType copies. Rule:
  only meetings file under 20-projects/<project>; for every other type the
  project is metadata, not a file location. Fixes the MCP create_note /
  create_decision tests that expected notes in 10-notes and decisions in
  30-decisions regardless of project.
- Register agentvault.ask as the 12th MCP tool (wired but uncounted); update
  the tools/list test, README, and codebase analysis.
- Fix the contract-check snake_case gate: the old `grep | head -20 && exit 1`
  always failed because head exits 0; it now only fails on actual matches.
- Drop a stray duplicate of contract.go and a broken Go snake-list helper
  from scripts/; gitignore the contract package's tsbuildinfo.

Verified: go vet/test/build green (core + desktop webkit2_41), make
contract-check passes, and all four clients build/type-check.

Co-Authored-By: Claude <noreply@anthropic.com>
The shared RAG service (CLI/API/desktop/MCP all route through
internal/rag.Pipeline), auto-index after writes (API + MCP), and the
folder-resolution consolidation are all done in the tree, so reflect
that in the improvement plan and codebase analysis instead of listing
them as pending with stale evidence. Bump the review dates.

Co-Authored-By: Claude <noreply@anthropic.com>
- Add Searcher.ConfigureEmbeddings and wire it into the HTTP API server so
  /search, /recent, /stale with ?vector=true can generate query embeddings.
- Fix @agentvault/contract query-param casing: send hybrid_weight to the
  server while keeping the TS API as hybridWeight; type recent/stale requests
  as RecentParams/StaleParams.
- Add --vector, --hybrid-weight, and --topk flags to the CLI search command.
- Add a vector-search toggle (and hybrid-weight slider) to the web UI.
- Add API tests for vector/hybrid query params.
- Update API_CONTRACT.md and IMPROVEMENT_PLAN.md.
- Add web ConnectionModal first-run flow and VaultStatus auth indicator.

- Extension popup shows token status and onboarding helper text.

- Mobile settings adds Verify Token via /auth/verify.

- Document /auth/verify in API_CONTRACT.md and IMPROVEMENT_PLAN.md.
- Configure embeddings in 'agentvault ask' so vector/hybrid RAG works.
- Remove meaningless vector/hybrid/topk params from /recent and /stale
  (those endpoints have no query text, so vector search was a silent no-op).
- Update Searcher.Stale to honor a limit parameter.
- Remove vector/hybrid/topk from RecentParams and StaleParams in the
  shared contract and API_CONTRACT.md.
- Add vector-search toggle + hybrid-weight control to the browser
  extension popup and mobile search screen.

All Go tests, make contract-check, and client builds pass.
…tings, capture sync

- Add Ask tab for source-grounded RAG questions via POST /ask

- Add Recent tab with note viewer using /recent and /notes/{id}

- Enhance Search with type/status filters and clickable note detail modal

- Add configurable server URL + token settings with host permission requests

- Add vault status, classified errors, and recovery hints in StatusBar

- Add offline capture queue with background retry (alarms) and explicit sync states

- Add keyboard shortcuts (Ctrl/Cmd+Shift+A/S) and improve context-menu/metadata extraction
- Add syncCaptures() utility with per-item syncStatus (syncing/failed/synced)
- Update localInbox storage to track sync lifecycle and retry count
- Wire Home, Inbox, and Settings screens through centralized sync
- Show syncing/failed states in CaptureCard
- Align Expo dependencies and move splash config to expo-splash-screen plugin
- Add missing transitive deps required for Metro bundling
- Add typecheck/doctor scripts and iOS export to CI
- Add root Stack navigator with NoteDetail screen
- Make search results tappable; fetch and render full note content
- Replace single-letter tab icons with accessible Ionicons
- Wrap screens in SafeAreaView to handle notches
- Add expo-font peer dependency for vector icons
…ble dashboard, security docs

Phase 1: add goreleaser, install script, release CI, auto-open browser, startup banner
Phase 2: readability extraction, capture sync states, ask-about-page, vitest queue tests
Phase 3: wiki-link indexing, /notes/{id}/links, backlinks panel, graph view
Phase 4: RRF hybrid ranking, query rewriting, chunk context expansion, retrieval eval
Phase 5: task/decision/meeting frontmatter, /tasks, /dashboard, Today dashboard
Phase 6: SECURITY.md, COMPATIBILITY.md, desktop vault status, mobile TS corruption fixes
- Home screen becomes Today dashboard with overdue/upcoming tasks and pending decisions
- NoteDetailScreen shows backlinks and outgoing links
- CaptureScreen supports webpage/URL captures
- CaptureCard renders tappable URLs
- SearchResultCard shows task/decision status badges
- Add getDashboard/getNoteLinks API wrappers and tests
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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