All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 2m7s
Six-phase upgrade of /training from a read-only dashboard into a full Style Studio for managing Daphna's style corpus. - Upload Sheet on /training: file → proofread preview → commit (no more CLI-only `upload-training` skill). - Rich corpus metadata: GET /api/training/corpus returns summary, outcome, key_principles, page_count, parties (regex), legal_citation, lessons_count. PATCH endpoint for chair edits. CorpusDetailDrawer with 4 tabs (details /content/lessons/patterns) replaces the bare table row. - LLM metadata enrichment: style_metadata_extractor + MCP tools (style_corpus_enrich, style_corpus_pending_enrichment) fill summary /outcome/key_principles via claude_session (free, host-side). - Per-decision lessons: new decision_lessons table + 4 REST endpoints + LessonsTab in drawer; hermes-curator now auto-posts findings as decision_lessons(source=curator). - Curator Portrait tab: prompt rendered with link to Gitea, recent curator findings, style_analyzer training prompts, propose-change form that writes proposals to data/curator-proposals/ for manual chair review (no auto-mutation of the agent file). - Style chat tab: SSE-streamed conversations with the style agent. New host-side pm2 service (legal-chat-service, port 8770) wraps claude CLI with stream-json + --resume continuation; FastAPI proxies via host.docker.internal. Zero API cost — uses chaim's claude.ai subscription. chat_conversations + chat_messages persist history. Architecture: keeps the existing rule that claude_session only runs on the host (not the container). The new legal-chat-service is the canonical bridge between the container and the local CLI for the chat feature; everything else (upload, metadata, lessons) stays within the container's existing capabilities. Audit script (scripts/audit_training_corpus.py) included for verifying which corpus rows still need enrichment. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
49 lines
1.5 KiB
JavaScript
49 lines
1.5 KiB
JavaScript
/**
|
|
* pm2 ecosystem entry for legal-chat-service — the host-side SSE bridge
|
|
* to ``claude`` CLI that powers the /training chat tab.
|
|
*
|
|
* Why pm2:
|
|
* - Auto-restart if the process dies (claude CLI subprocess failures
|
|
* should never leave the service in a half-dead state).
|
|
* - Log rotation matches paperclip's behavior so the chair sees
|
|
* consistent log paths under ~/.pm2/logs/.
|
|
*
|
|
* Install (once):
|
|
* pm2 start /home/chaim/legal-ai/scripts/legal-chat-service.config.cjs
|
|
* pm2 save
|
|
*
|
|
* Smoke test:
|
|
* curl http://127.0.0.1:8770/health
|
|
* # → {"ok":true,"service":"legal-chat-service"}
|
|
*
|
|
* Update:
|
|
* pm2 restart legal-chat-service
|
|
*
|
|
* Stop:
|
|
* pm2 stop legal-chat-service
|
|
*/
|
|
|
|
module.exports = {
|
|
apps: [
|
|
{
|
|
name: "legal-chat-service",
|
|
cwd: "/home/chaim/legal-ai/mcp-server",
|
|
// Run the in-package server via the venv interpreter so all
|
|
// imports (claude_session, etc) resolve.
|
|
script: "/home/chaim/legal-ai/mcp-server/.venv/bin/python",
|
|
args: "-m legal_mcp.chat_service.server --port 8770",
|
|
// claude CLI looks up credentials under HOME — make sure it
|
|
// sees Daphna's session, not an empty container HOME.
|
|
env: {
|
|
HOME: "/home/chaim",
|
|
PATH: "/home/chaim/.local/bin:/usr/local/bin:/usr/bin:/bin",
|
|
PYTHONUNBUFFERED: "1",
|
|
},
|
|
restart_delay: 5000,
|
|
max_restarts: 10,
|
|
autorestart: true,
|
|
max_memory_restart: "500M",
|
|
},
|
|
],
|
|
};
|