Skip to content

MP-78: /open: скоуп и чат организации для межпроектной работы - #81

Merged
prineycom merged 24 commits into
mainfrom
task/MP-78-open-organization-scope
Nov 6, 2026
Merged

prineycom merged 24 commits into
mainfrom
task/MP-78-open-organization-scope

Conversation

@prineycom

Copy link
Copy Markdown
Collaborator

Goal

Adds a fourth session scope, the organization, so that one chat can coordinate work across all registered projects of one organization. The example is TB-FF, whose plan touches several of its repositories.

  • /open tb-ff (MCP open_session, CLI mypi open) opens, focuses or resumes the organization session.
    • The Herdr tab is org-<slug> in workspace <slug>, and the session starts in the engine root.
    • It never clones its projects or creates worktrees for them.
  • The organization chat acts like a project chat over every registered project of its organization: it opens their task tabs, messages their tasks and runs the pipeline skills on their keys. No project chat is needed in between.
  • A task has two allowed parents: its project chat and its organization chat.
    • turn_end and waiting go to whoever sent the message that started the turn.
    • A milestone goes to the parent that last wrote to the task, else to the project chat. It is skipped when the recipient made the change itself.
  • Global, project and task sessions behave as before.
  • Unknown organizations, organizations without projects, and the reserved keys global and all are refused with clear errors.

Plan: https://draft.yokeloop.com/artifacts/mp-78-open-e8cilgx9

Changes

  • Key grammar. The bare lowercase organization slug is a session key wherever keys are parsed: open, registration, the registry, the tree, events, warmup, the start message, Pi completions and scripts/pipeline/mp-task scope.
  • Migration 013.
    • sessions gains scope_type = 'org' and an org_id foreign key with ON DELETE RESTRICT. The used_project_code trigger is recreated.
    • org remove refuses while sessions or events reference the organization.
  • Events.
    • Turn events are routed to the sender recorded in the parent-message frame, for both Claude hooks and the Pi extension.
    • Milestones are routed to the last writing parent.
    • A fast test checks that the two copies of the PARENT_MESSAGE regex stay identical.
  • Organization chat context.
    • A new organization warmup: the org role, global and organization memory, and a compact ## Projects section.
    • A new organization start message.
    • The texts in integrations/prompts were condensed so the 9500-character Claude warmup budget still holds.
  • Pipeline. mp-task scope gains the org and codes fields. Step 0 of the /plan, /do, /flow, /ship and /board skills and docs/PIPELINE.md cover the organization case.
  • Docs.
    • README, AGENTS.md, docs/{MCP,M1-CLI,ARCHITECTURE,HTTP-API,PIPELINE,TESTING,MANUAL-ACCEPTANCE}.md and the .yoke/context.md glossary.
    • ADR 0005 amends ADRs 0001, 0003 and 0004.
    • The tool descriptions in src/mcp/** and the CLI usage text.
    • A CHANGELOG entry.

Checks

  • mise exec -- pnpm build: exit 0.
  • mise exec -- pnpm verify on d6780e6: exit 0. Fast 178/0, boundary 65/0, wall 49.4 s, memory peak 526 MiB.

Review

Three rounds by a fresh reviewer each time; final verdict: approved.

  • Round 1: the remote task_update description and the schema-12 statement in HTTP-API.md were out of date. Advice covered the parent rules, /board texts, a test for the regex copy and the CLI usage text. All were fixed.
  • Round 2: the remote send_message description was out of date. Fixed. The warmup texts were also condensed after a stand measurement: the real global warmup would otherwise have gone about 30 characters over the 9500 budget. The global golden grew by only 98 characters over the base (8416 → 8514).
  • Round 3: approved.

Open advice (not applied):

  • integrations/prompts/howto.md:11 says "unless that chat made it". A reader can take "that chat" to mean only the project chat. The code and every other text mean the recipient. A clearer wording would be "unless the recipient made it".

Live acceptance (disposable stand)

  • Setup: candidate 0ab8570 for checks 1–12, d6780e6 for the budget check. Pi 1.0.4 (openai-codex gpt-6-sol), Claude Code 2.1.283 (Haiku 4.5), herdr 0.9.5, node 24.21.0, schema 13.
  • Fixtures (synthetic):
    • organization tb-ff: TBA and TBD with clones, HSK without a clone;
    • organization two: OT;
    • organization empty.
  • Results: all criteria PASS.
    • Refusals for nope, all, global and empty.
    • Open, focus and resume with the same native id.
    • Organization start message and warmup: projects listed, HSK shown as no clone, no project memory.
    • The organization chat opens TBA-1 with a message; the task's turn_end arrives live in the organization chat and not in TBA.
    • Milestones go to the last writer, or to the project when no parent has written to the task. No milestone appears when the organization chat makes the change itself.
    • Sending to a task of another organization is refused.
    • Project-chat flows are unchanged.
    • Pi /open completions show only the organization's projects and tasks.
    • In a Claude organization chat, /board shows the organization's boards and /plan OT-1 is refused.
    • org remove tb-ff is refused.
    • Warmup sizes under --max-chars 9500: global 8793, org 8187, project 8026, task 7898.
  • Model turns: 8 of a budget of 30.
  • Limitations:
    • Most checks ran with Pi. Only check 12 used Claude, because the Claude usage limit was close.
    • Tabs opened by /open start without isolation flags and load the user's personal extensions.
    • Haiku paraphrased the scope refusal text instead of quoting it.

Not part of this PR

  • mypi db init for schema 13 on the installed engine is a separately authorized step after merge.

🤖 Generated with Claude Code

@prineycom
prineycom merged commit e1596c2 into main Nov 6, 2026
1 check passed
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