rename(547): the server is grimoire — package, image, DB defaults, backups
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 56s
CI & Build / integration (push) Successful in 1m4s
CI & Build / Python tests (push) Successful in 1m55s
CI & Build / Build & push image (push) Successful in 44s

Step 2 of the Scribe -> Grimoire rename.

- src/scribe -> src/grimoire, and every import, patch target, module path,
  hypercorn entry point and `python -m grimoire.restore` with it; pyproject,
  uv.lock and the frontend package are named grimoire.
- Image git.fabledsword.com/bvandeusen/fabledgrimoire; CI's Postgres service
  runs as grimoire / grimoire_test.
- Compose files default the DB user, database and (prod) volume to grimoire,
  each overridable from .env, so an install created as Scribe keeps its data
  by setting POSTGRES_USER, POSTGRES_DB and PGDATA_VOLUME.
- Backups are written as grimoire-<ts>.tar with format grimoire-backup-tar.
  Archives named scribe-* with the scribe-backup-tar manifest still restore
  and are still counted at the destination (folder and S3), with tests.
- Exports, the MCP auth realm, the ASGI scope key and the persistent logger
  carry the new name.

Kept on purpose: the secret-sealing key label stays "scribe.secrets.v1",
because every stored secret was derived under it.

Plugin identity (plugin name, hooks, env vars, .scribe marker, skills) is
step 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-22 10:50:45 -04:00
co-authored by Claude Opus 5.5
parent e99f1169f7
commit 0f5ef0be63
447 changed files with 3611 additions and 3558 deletions
+12 -12
View File
@@ -22,9 +22,9 @@ from unittest.mock import AsyncMock, patch
import pytest
from scribe.mcp._context import _user_id_ctx
from scribe.mcp.tools.lessons import create_lesson, update_lesson
from scribe.services import lessons as lessons_svc
from grimoire.mcp._context import _user_id_ctx
from grimoire.mcp.tools.lessons import create_lesson, update_lesson
from grimoire.services import lessons as lessons_svc
TRIGGER = "a test fails on code you believe is correct"
SUBJECT = "Suspect the guard before the code"
@@ -73,9 +73,9 @@ async def test_a_lesson_keeps_every_incident_that_taught_it():
_user_id_ctx.set(7)
created = AsyncMock(return_value=_stub_note())
with patch.object(lessons_svc, "create_lesson", created), \
patch("scribe.mcp.tools.lessons.dedup_svc.find_duplicate_note",
patch("grimoire.mcp.tools.lessons.dedup_svc.find_duplicate_note",
AsyncMock(return_value=None)), \
patch("scribe.mcp.tools.lessons.systems_tools.attach_systems", AsyncMock()):
patch("grimoire.mcp.tools.lessons.systems_tools.attach_systems", AsyncMock()):
await create_lesson(
what=SUBJECT, when_to_apply=TRIGGER, learned_from=[11, 22, 33],
)
@@ -101,7 +101,7 @@ async def test_the_duplicate_gate_runs_before_anything_is_created():
hit = SimpleNamespace(id=99, title="already recorded", similarity=0.97,
reason="semantic")
created = AsyncMock()
with patch("scribe.mcp.tools.lessons.dedup_svc.find_duplicate_note",
with patch("grimoire.mcp.tools.lessons.dedup_svc.find_duplicate_note",
AsyncMock(return_value=hit)), \
patch.object(lessons_svc, "create_lesson", created):
out = await create_lesson(what=SUBJECT, when_to_apply=TRIGGER)
@@ -122,10 +122,10 @@ async def test_the_gate_compares_the_composed_document_not_the_raw_fields():
document, and would judge two lessons alike that rank nothing alike."""
_user_id_ctx.set(7)
gate = AsyncMock(return_value=None)
with patch("scribe.mcp.tools.lessons.dedup_svc.find_duplicate_note", gate), \
with patch("grimoire.mcp.tools.lessons.dedup_svc.find_duplicate_note", gate), \
patch.object(lessons_svc, "create_lesson",
AsyncMock(return_value=_stub_note())), \
patch("scribe.mcp.tools.lessons.systems_tools.attach_systems", AsyncMock()):
patch("grimoire.mcp.tools.lessons.systems_tools.attach_systems", AsyncMock()):
await create_lesson(what=SUBJECT, when_to_apply=TRIGGER, insight="Look.")
title, body = gate.await_args.args[1], gate.await_args.args[2]
@@ -140,7 +140,7 @@ def test_a_lesson_is_judged_at_the_trigger_dominated_bar():
mostly prose ABOUT the thing. A lesson's document is that shape, so the
bar sits above that band — otherwise two different lessons about one area
block each other, which is the failure step 4 asked to check for."""
from scribe.services.dedup import (
from grimoire.services.dedup import (
_LESSON_SEMANTIC_THRESHOLD,
_SEMANTIC_THRESHOLD,
_semantic_threshold,
@@ -154,7 +154,7 @@ def test_a_lesson_is_judged_at_the_trigger_dominated_bar():
assert _LESSON_SEMANTIC_THRESHOLD > _SEMANTIC_THRESHOLD
# The carve-out is per kind, not a loosening of the gate: a lesson's bar is
# its own, apart from the note's copy band.
from scribe.services.dedup import _NOTE_COPY_THRESHOLD
from grimoire.services.dedup import _NOTE_COPY_THRESHOLD
assert _semantic_threshold("note") == _NOTE_COPY_THRESHOLD
assert _NOTE_COPY_THRESHOLD != _LESSON_SEMANTIC_THRESHOLD
@@ -175,7 +175,7 @@ async def test_an_update_recomposes_both_halves_of_the_document():
)
updated = AsyncMock(return_value=_stub_note())
with patch.object(lessons_svc, "get_lesson", AsyncMock(return_value=stored)), \
patch("scribe.services.notes.update_note", updated):
patch("grimoire.services.notes.update_note", updated):
await lessons_svc.update_lesson(7, 1, when_to_apply="a guard goes red")
fields = updated.await_args.kwargs
@@ -198,7 +198,7 @@ async def test_an_update_does_not_stack_the_composed_lines():
)
updated = AsyncMock(return_value=_stub_note())
with patch.object(lessons_svc, "get_lesson", AsyncMock(return_value=stored)), \
patch("scribe.services.notes.update_note", updated):
patch("grimoire.services.notes.update_note", updated):
await lessons_svc.update_lesson(7, 1, what="Suspect the guard")
body = updated.await_args.kwargs["body"]