fix(8564): a decision about a family idea lands in no project, so the fence stops asking when a session promotes another project's idea
CI & Build / TypeScript typecheck (push) Canceled after 0s
CI & Build / Plugin hooks (push) Canceled after 0s
CI & Build / Python lint (push) Canceled after 0s
CI & Build / Python tests (push) Canceled after 0s
CI & Build / integration (push) Canceled after 0s
CI & Build / Build & push image (push) Canceled after 0s
CI & Build / TypeScript typecheck (push) Canceled after 0s
CI & Build / Plugin hooks (push) Canceled after 0s
CI & Build / Python lint (push) Canceled after 0s
CI & Build / Python tests (push) Canceled after 0s
CI & Build / integration (push) Canceled after 0s
CI & Build / Build & push image (push) Canceled after 0s
Promoting, proposing, revising, retiring, and setting references or topic write only the family's own state, never the record that carries the idea. The project fence located them at that record's project, so the usual path (the trigger fires in the project that built the idea second) always asked the operator about a change to a project that nothing touched. A project's answer stays located: assessments, conflicts, and undoing an assessment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -66,7 +66,7 @@ Saved procedures, such as a drift audit or a DRY pass. The plugin syncs each one
|
|||||||
The whole store is reachable through the MCP endpoint at `/mcp`, authenticated with an API key. The Claude Code plugin in this repo adds:
|
The whole store is reachable through the MCP endpoint at `/mcp`, authenticated with an API key. The Claude Code plugin in this repo adds:
|
||||||
|
|
||||||
- hooks for session start, each prompt, before and after tool calls, the end of a turn, compaction and session end, all failing open if Grimoire is unreachable;
|
- hooks for session start, each prompt, before and after tool calls, the end of a turn, compaction and session end, all failing open if Grimoire is unreachable;
|
||||||
- a project fence: a session belongs to the project its starting directory is bound to. Toward any other project it can read anything and file an issue. Editing that project's files, committing or pushing in its repo, or changing its records first asks you, in every permission mode;
|
- a project fence: a session belongs to the project its starting directory is bound to. Toward any other project it can read anything and file an issue. Editing that project's files, committing or pushing in its repo, or changing its records first asks you, in every permission mode. Deciding about a family idea (promoting, revising or retiring it) belongs to the family, so it never asks; a project's answer to an idea stays that project's;
|
||||||
- skills for the working practices: using Grimoire, writing plans, systematic debugging, verification, brainstorming, reporting back, reusing code, shape accounting and family canon;
|
- skills for the working practices: using Grimoire, writing plans, systematic debugging, verification, brainstorming, reporting back, reusing code, shape accounting and family canon;
|
||||||
- your stored processes as skills.
|
- your stored processes as skills.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "grimoire",
|
"name": "grimoire",
|
||||||
"description": "Grimoire for Claude Code: connects the grimoire MCP server, adds the hooks that deliver live project state and relevant records at the right moment, ships the shared client-neutral Grimoire skills (using-grimoire, writing-plans, reporting-back, systematic-debugging, verification, brainstorming, reusing-code, shape-accounting, family-canon, reviewing-tests), and syncs your saved Grimoire Processes as skills (/grimoire:sync).",
|
"description": "Grimoire for Claude Code: connects the grimoire MCP server, adds the hooks that deliver live project state and relevant records at the right moment, ships the shared client-neutral Grimoire skills (using-grimoire, writing-plans, reporting-back, systematic-debugging, verification, brainstorming, reusing-code, shape-accounting, family-canon, reviewing-tests), and syncs your saved Grimoire Processes as skills (/grimoire:sync).",
|
||||||
"version": "2026.12.03.0415",
|
"version": "2026.12.04.1936",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Bryan Van Deusen"
|
"name": "Bryan Van Deusen"
|
||||||
},
|
},
|
||||||
|
|||||||
+3
-1
@@ -89,7 +89,9 @@ On install you'll be asked for:
|
|||||||
reset in its repo (from `git -C`, after `cd`, or in a worktree of it), and a
|
reset in its repo (from `git -C`, after `cd`, or in a worktree of it), and a
|
||||||
Grimoire write that lands in another project each stop on a permission
|
Grimoire write that lands in another project each stop on a permission
|
||||||
prompt naming that project, in every permission mode. Filing an issue there
|
prompt naming that project, in every permission mode. Filing an issue there
|
||||||
(`create_task(kind="issue")`) and every read go ahead. An edit in the
|
(`create_task(kind="issue")`), a decision about a family idea (it changes
|
||||||
|
the family's state, not the project whose record carries the idea), and
|
||||||
|
every read go ahead. An edit in the
|
||||||
session's own repo never calls the server. It can't see a non-git shell
|
session's own repo never calls the server. It can't see a non-git shell
|
||||||
write into another repo (`sed -i`, a redirect), but it fences that repo's
|
write into another repo (`sed -i`, a redirect), but it fences that repo's
|
||||||
commit and push. When the instance doesn't answer, the act goes ahead and
|
commit and push. When the instance doesn't answer, the act goes ahead and
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ RULE = "rule" # a project rule: its project. A global rule: none
|
|||||||
RELATION = "relation" # a rule relation: the projects of its two rules
|
RELATION = "relation" # a rule relation: the projects of its two rules
|
||||||
TRASH = "trash" # a deleted batch: every project its rows belong to
|
TRASH = "trash" # a deleted batch: every project its rows belong to
|
||||||
REPO = "repo" # a repo remote: the project it is bound to
|
REPO = "repo" # a repo remote: the project it is bound to
|
||||||
DECISION = "decision" # a family decision: its project, else its idea's home
|
DECISION = "decision" # a family decision: the project whose answer it is; an idea-level one, none
|
||||||
|
|
||||||
LOCATORS = frozenset({PROJECT, NOTE, MILESTONE, SYSTEM, RULE, RELATION, TRASH, REPO, DECISION})
|
LOCATORS = frozenset({PROJECT, NOTE, MILESTONE, SYSTEM, RULE, RELATION, TRASH, REPO, DECISION})
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@ LOCATORS = frozenset({PROJECT, NOTE, MILESTONE, SYSTEM, RULE, RELATION, TRASH, R
|
|||||||
# - install-level settings (moment mappings, retrieval dials);
|
# - install-level settings (moment mappings, retrieval dials);
|
||||||
# - user-level records (processes, design systems, rulebooks, topics, global
|
# - user-level records (processes, design systems, rulebooks, topics, global
|
||||||
# rules and preferences);
|
# rules and preferences);
|
||||||
|
# - decisions about a family idea, which belong to the family (below);
|
||||||
# - judgments the system asks a session for in any project (a rule's outcome,
|
# - judgments the system asks a session for in any project (a rule's outcome,
|
||||||
# a lesson-to-rule link, moment proposals, a menu verdict). Those describe how
|
# a lesson-to-rule link, moment proposals, a menu verdict). Those describe how
|
||||||
# the corpus is retrieved; they don't change another project's work.
|
# the corpus is retrieved; they don't change another project's work.
|
||||||
@@ -77,14 +78,23 @@ WRITE_TARGETS: dict[str, dict[str, str]] = {
|
|||||||
# elsewhere, the project it leaves.
|
# elsewhere, the project it leaves.
|
||||||
"bind_repo": {"project_id": PROJECT, "repo_url": REPO},
|
"bind_repo": {"project_id": PROJECT, "repo_url": REPO},
|
||||||
"unbind_repo": {"repo_url": REPO},
|
"unbind_repo": {"repo_url": REPO},
|
||||||
# family canon. An idea is a record in its home project; an adoption is a
|
# family canon. A decision about an idea — proposing, promoting, revising,
|
||||||
# project's answer; a conflict is between the two projects it names.
|
# retiring it, naming its references or its topic — belongs to the family,
|
||||||
"propose_family_idea": {"note_id": NOTE},
|
# not to the project whose record first carried the idea: it writes only
|
||||||
"promote_family_idea": {"note_id": NOTE},
|
# the family's own state (status, platforms, version, the decision log,
|
||||||
"retire_family_idea": {"note_id": NOTE},
|
# the ledger's unassessed rows), never that record. The trigger that opens
|
||||||
"revise_family_idea": {"note_id": NOTE},
|
# an evaluation fires in the project that built the idea second, so the
|
||||||
"set_family_references": {"note_id": NOTE},
|
# session deciding is usually not the origin's; locating these at the
|
||||||
"set_family_topic": {"note_id": NOTE},
|
# origin would put a prompt about a change to that project in front of
|
||||||
|
# the operator when nothing in it changes. A project's ANSWER is that
|
||||||
|
# project's: an assessment, a conflict (it writes both projects'
|
||||||
|
# answers), and undoing an answer.
|
||||||
|
"propose_family_idea": {},
|
||||||
|
"promote_family_idea": {},
|
||||||
|
"retire_family_idea": {},
|
||||||
|
"revise_family_idea": {},
|
||||||
|
"set_family_references": {},
|
||||||
|
"set_family_topic": {},
|
||||||
"undo_family_decision": {"decision_id": DECISION},
|
"undo_family_decision": {"decision_id": DECISION},
|
||||||
"assess_family_adoption": {"project_id": PROJECT},
|
"assess_family_adoption": {"project_id": PROJECT},
|
||||||
"resolve_family_conflict": {"canon_project_id": PROJECT, "other_project_id": PROJECT},
|
"resolve_family_conflict": {"canon_project_id": PROJECT, "other_project_id": PROJECT},
|
||||||
@@ -159,7 +169,15 @@ LOCATOR_NAMES = frozenset({
|
|||||||
|
|
||||||
# Arguments with a locating name that only point at a record, with why each one
|
# Arguments with a locating name that only point at a record, with why each one
|
||||||
# doesn't say where the write lands.
|
# doesn't say where the write lands.
|
||||||
|
_FAMILY_IDEA = "the family idea the decision is about; it writes the family's state, not the record's project"
|
||||||
|
|
||||||
REFERENCES: dict[str, dict[str, str]] = {
|
REFERENCES: dict[str, dict[str, str]] = {
|
||||||
|
"propose_family_idea": {"note_id": _FAMILY_IDEA},
|
||||||
|
"promote_family_idea": {"note_id": _FAMILY_IDEA},
|
||||||
|
"retire_family_idea": {"note_id": _FAMILY_IDEA},
|
||||||
|
"revise_family_idea": {"note_id": _FAMILY_IDEA},
|
||||||
|
"set_family_references": {"note_id": _FAMILY_IDEA},
|
||||||
|
"set_family_topic": {"note_id": _FAMILY_IDEA},
|
||||||
"classify_shapes_by_rule": {
|
"classify_shapes_by_rule": {
|
||||||
"snippet_id": "the canon the shapes are judged against; the rows written are project_id's",
|
"snippet_id": "the canon the shapes are judged against; the rows written are project_id's",
|
||||||
},
|
},
|
||||||
@@ -270,12 +288,12 @@ async def _projects_of(user_id: int, kind: str, value) -> set[int]:
|
|||||||
)
|
)
|
||||||
return {p for p in rows.scalars() if p}
|
return {p for p in rows.scalars() if p}
|
||||||
if kind == DECISION:
|
if kind == DECISION:
|
||||||
|
# An assessment carries the project it answered for; a decision
|
||||||
|
# about the idea itself carries none and lands in no project.
|
||||||
rows = await session.execute(
|
rows = await session.execute(
|
||||||
select(FamilyDecision.project_id, Note.project_id)
|
select(FamilyDecision.project_id).where(FamilyDecision.id.in_(ids))
|
||||||
.join(Note, Note.id == FamilyDecision.idea_id)
|
|
||||||
.where(FamilyDecision.id.in_(ids))
|
|
||||||
)
|
)
|
||||||
return {own or home for own, home in rows.all() if own or home}
|
return {p for p in rows.scalars() if p}
|
||||||
model = {NOTE: Note, MILESTONE: Milestone, SYSTEM: System, RULE: Rule}[kind]
|
model = {NOTE: Note, MILESTONE: Milestone, SYSTEM: System, RULE: Rule}[kind]
|
||||||
rows = await session.execute(select(model.project_id).where(model.id.in_(ids)))
|
rows = await session.execute(select(model.project_id).where(model.id.in_(ids)))
|
||||||
return {p for p in rows.scalars() if p}
|
return {p for p in rows.scalars() if p}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import pytest_asyncio
|
|||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
|
|
||||||
from grimoire.models import async_session
|
from grimoire.models import async_session
|
||||||
|
from grimoire.models.family import FamilyDecision, FamilyIdea
|
||||||
from grimoire.models.milestone import Milestone
|
from grimoire.models.milestone import Milestone
|
||||||
from grimoire.models.note import Note
|
from grimoire.models.note import Note
|
||||||
from grimoire.models.project import Project
|
from grimoire.models.project import Project
|
||||||
@@ -45,10 +46,21 @@ async def two_projects():
|
|||||||
note_type="note", task_kind="work", status="todo")
|
note_type="note", task_kind="work", status="todo")
|
||||||
trashed = Note(user_id=user.id, project_id=other.id, title="Trashed", body="",
|
trashed = Note(user_id=user.id, project_id=other.id, title="Trashed", body="",
|
||||||
note_type="note", deleted_batch_id=BATCH)
|
note_type="note", deleted_batch_id=BATCH)
|
||||||
s.add_all([theirs, mine, trashed])
|
idea = Note(user_id=user.id, project_id=other.id, title="Their idea", body="",
|
||||||
|
note_type="snippet")
|
||||||
|
s.add_all([theirs, mine, trashed, idea])
|
||||||
|
await s.flush()
|
||||||
|
s.add(FamilyIdea(note_id=idea.id, status="candidate"))
|
||||||
|
await s.flush()
|
||||||
|
proposed = FamilyDecision(idea_id=idea.id, project_id=None, action="propose",
|
||||||
|
reason="repeated", decided_via="system", user_id=user.id)
|
||||||
|
answered = FamilyDecision(idea_id=idea.id, project_id=home.id, action="assess",
|
||||||
|
reason="exempt here", decided_via="agent", user_id=user.id)
|
||||||
|
s.add_all([proposed, answered])
|
||||||
await s.commit()
|
await s.commit()
|
||||||
return {"user": user.id, "home": home.id, "other": other.id, "plan": plan.id,
|
return {"user": user.id, "home": home.id, "other": other.id, "plan": plan.id,
|
||||||
"area": area.id, "theirs": theirs.id, "mine": mine.id}
|
"area": area.id, "theirs": theirs.id, "mine": mine.id, "idea": idea.id,
|
||||||
|
"proposed": proposed.id, "answered": answered.id}
|
||||||
|
|
||||||
|
|
||||||
async def test_each_locator_finds_the_project_of_the_row_it_names(two_projects):
|
async def test_each_locator_finds_the_project_of_the_row_it_names(two_projects):
|
||||||
@@ -67,6 +79,27 @@ async def test_each_locator_finds_the_project_of_the_row_it_names(two_projects):
|
|||||||
assert await lands("create_rule", topic_id=1) == set()
|
assert await lands("create_rule", topic_id=1) == set()
|
||||||
|
|
||||||
|
|
||||||
|
async def test_a_decision_about_a_family_idea_lands_in_no_project_and_an_answer_in_its_own(two_projects):
|
||||||
|
# The idea's record lives in the other project, but deciding about the
|
||||||
|
# idea writes only the family's state; undoing a project's answer writes
|
||||||
|
# that project's ledger row.
|
||||||
|
ids = two_projects
|
||||||
|
uid, home = ids["user"], ids["home"]
|
||||||
|
|
||||||
|
async def lands(tool, **args):
|
||||||
|
return await write_scope.tool_targets(uid, tool, args)
|
||||||
|
|
||||||
|
for tool in ("propose_family_idea", "promote_family_idea", "revise_family_idea",
|
||||||
|
"retire_family_idea", "set_family_references", "set_family_topic"):
|
||||||
|
assert await lands(tool, note_id=ids["idea"]) == set(), tool
|
||||||
|
assert await lands("undo_family_decision", decision_id=ids["proposed"]) == set()
|
||||||
|
assert await lands("undo_family_decision", decision_id=ids["answered"]) == {home}
|
||||||
|
|
||||||
|
promote = await write_scope.check_act(uid, home, tool="promote_family_idea",
|
||||||
|
args={"note_id": ids["idea"]})
|
||||||
|
assert promote["allowed"] is True
|
||||||
|
|
||||||
|
|
||||||
async def test_a_session_in_one_project_is_asked_before_writing_in_the_other(two_projects):
|
async def test_a_session_in_one_project_is_asked_before_writing_in_the_other(two_projects):
|
||||||
ids = two_projects
|
ids = two_projects
|
||||||
uid, home, other = ids["user"], ids["home"], ids["other"]
|
uid, home, other = ids["user"], ids["home"], ids["other"]
|
||||||
|
|||||||
Reference in New Issue
Block a user