Skip to content

Software Factory, and teams that work without config: a chat asks instead of a flag - #624

Merged
FMXExpress merged 4 commits into
mainfrom
claude/pasclaw-desktop-plan-uapzcp
Oct 30, 2026
Merged

FMXExpress merged 4 commits into
mainfrom
claude/pasclaw-desktop-plan-uapzcp

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Three commits on top of #623. Together they make one sentence on the desktop become a team building it, with no config to edit.

0463c2f — the Software Factory

  • Start it. Start → Software Factory takes a sentence and a team template: Software Team by default, Duo for small things. Ask PasClaw gets the same thing as a new option, Build with a team. New Team… and the model's own team_up now open the factory too.
  • The factory window puts the conversation with the team's lead beside its live board.
    • Timeline: one list, with times, of what you told the lead, what the lead replied at the end of each turn, and the board's events ("dev submitted T0002 for review", "foreman rejected T0002: …").
    • Board: Accept / Reject on work in review, plus Edit and + Task.
    • Header: whether the team is working, waiting, parked or finished; who is busy and what waits in each mailbox; any question the team asked you, with Answer.
    • It repaints on events (no polling) and comes back after a reload.
  • Steering.
    • What you type in the factory goes to the lead.
    • After Build with a team, Ask switches itself to Tell the … team. Every running team gets that entry.
    • Writing to a team that parked itself because its board was finished puts it back to work. A team you parked yourself stays parked.
  • Server.
    • New GET /v1/teams/<name>/feed serves the window.
    • The lead's side is a new record: each finished turn's reply is kept with its time in replies.jsonl, because a session holds the transcript but no times.
    • /v1/teams/status and /v1/teams/up now name each team's leads.

47fee38 + 7a1ec40 — no flags: team members always have their tools, a chat asks

desktop_tools_enabled and agent_tools_enabled were off by default, and nobody turns them on. So a team started on a fresh install woke its lead with no task tool.

  • A standing agent always has the board tools and the agent tool. A team is those tools, and starting one is the opt-in.
  • An ordinary chat asks. That covers the CLI, project chats and Ask.
    • Discovery: the tools aren't in a chat's tool list, so there are no schema bytes until they're wanted. tool_search finds them.
    • Calling one: goes through the existing permissions machinery. You get Allow once / Allow for this session / Deny in Needs you (or the TUI footer, or the CLI prompt), with a reason, e.g. "This chat wants to manage the project board (task create)".
    • Nobody to ask: the call is refused, never quietly allowed.
    • Rules: a permissions allow rule says yes in advance, a deny still refuses, and a standing agent's own turn is never asked.
  • team_up from a chat is asked the same way. The check reads the same normalised action list the tool itself uses, so an unusual spelling ({"action":"team_up"}, TEAM_UP) can't slip past. Tiling windows asks nothing.
  • The old switches still mean "yes, every chat" for configs that set them. The "flags are off" warnings are gone.
  • MCP: these tools aren't exposed over PasClaw's MCP server, which has nobody to ask.
  • Needs you now describes a call with no resource by its arguments ("task: create, title Add a search box, project shop") and wraps the reason.

Testing

  • Full suite: make test passes under FPC 3.2.2, and make bench-teamboard is unchanged (29 calls, handoffs under a second).
  • Live, with no flags in config:
    • Team turn vs chat: the Foreman's first request carried task, agent, project and rule; an ordinary chat on the same gateway carried none of them.
    • The ask: the chat found task with tool_search, the call waited in Needs you, and Allow once ran it, putting the task on the board.
    • Nobody to ask: with no desktop connected, the same call was refused.
  • Factory, in Chromium (Playwright, against a live gateway, with the model played through the relay):
    • Ask started a Duo team from one sentence and the factory opened.
    • The timeline showed the kickoff, the lead's plan and the board's events.
    • Follow-ups from the factory and from Ask both reached the lead.
    • The window came back after a reload, with no page errors.
  • New tests:
    • desktop_routes_tests: the feed's records, merge order, limit and same-second ordering; status; resume-on-message.
    • team_board_tests: the ask through the real dispatcher (ask, allow once, deny, nobody to ask, allow rule, a standing agent's turn, team_up, tiling).
    • mcp_server_tests: not exposed.
    • projects_tests: the team_up question for every shape.
  • Revert-checks: for each rule I disabled it in the code and confirmed a test failed: 22 of 23 caught. The one miss is a redundant pre-check whose rule is enforced, and checked, elsewhere.
  • Not compiled with Delphi (dcc64). Only FPC is available here.

Known and not changed

  • When an ask is refused because no desktop is connected, the model is told "the user declined". That wording predates this PR and applies to every ask rule.
  • In Ask's Auto mode, whether the model reaches for a team still depends on the model. Build with a team is the sure path.

Generated by Claude Code

A team could already plan a goal into tasks, build them and review each
one -- but it was started in one window, watched in a second and talked
to in a third, and the desktop's Ask built apps with a single agent
unless the model happened to pick a team.

- Start -> Software Factory, and "Build with a team" in Ask PasClaw: a
  sentence and a team template (Software Team by default, Duo for small
  things) start a team and open its factory window. New Team... and the
  model's team_up open it too.
- The factory window: the conversation with the team's lead beside its
  live board. One timeline -- what the operator told the lead, what the
  lead replied at the end of each turn, and the board's events, each
  with its time; the board with Accept/Reject, Edit and + Task; a header
  with the team's state, who is busy and what waits in each mailbox, and
  the questions the team asked. Repaints on events, comes back after a
  reload.
- Follow-ups go to the team. The factory's composer writes to the lead;
  after "Build with a team" Ask switches to "Tell the ... team", and every
  team at work has that entry. The operator writing to a team its
  finished board parked puts it back on; one the operator parked stays.
- GET /v1/teams/<name>/feed serves the window. The lead's side is a new
  record: each finished turn's reply is kept with its time
  (replies.jsonl), because a session has the transcript but no times.
  /v1/teams/status and /v1/teams/up name each team's leads.

Driven end to end in Chromium against a live gateway with the model
played through the relay: Ask started a Duo team, the factory showed the
kickoff, the lead's plan and the board's events, and follow-ups from the
factory and from Ask both reached the lead. Server pieces revert-checked
(ten caught; the eleventh is a prefilter whose rule ResumeParkedTeams
holds and is already checked). Full make test passes; the replay bench
is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
…agent tools

A team is its board tools (project/task/rule) and the agent tool, and
both sat behind flags that are off by default -- so a team started from
the desktop on a fresh install woke its lead with no task tool, and the
best the gateway could do was warn. Starting a team is already the
operator's opt-in to agents that manage a board and message each other.

The flags now decide one thing: whether an ORDINARY chat's model has the
tools too. Off (the default), they register AgentOnly -- a new tool flag:
offered in ToProviderDefs only on a standing agent's turn (the calling
agent on this thread, via AgentTurnProbe), and refused by RunTool
otherwise, so a model cannot call one it was never shown. On, everyone
has them, as before. Same at gateway, serve and the CLI.

The team-up warnings about the flags (desktop route and CLI) are gone:
there is nothing left to warn about.

Checked live with neither flag in config: team up gave no warning, the
Foreman's first request carried task/agent/project/rule, and an ordinary
chat on the same gateway carried none. Unit-tested and revert-checked
(three of three caught). Full make test passes; the replay bench is
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
A flag nobody turns on is a capability nobody has. The board tools
(project/task/rule), the agent tool and the desktop tool's team_up were
off for every ordinary chat unless config said otherwise, and nobody
edits config.

Now an ordinary chat ASKS. Those tools are not in a chat's tool list --
no schema bytes until wanted -- but tool_search finds them, and calling
one puts the question to the operator through the permissions machinery
that already existed: Allow once / Allow for this session / Deny, in
Needs you on the desktop, the TUI footer or the CLI prompt, with a reason
saying what the chat wants ("This chat wants to manage the project board
(task create)"). With nobody to ask the call is refused, never quietly
allowed. A permissions "allow" rule says yes in advance; a "deny" still
refuses; a standing agent's own turn is never asked. team_up is asked
the same way, read from the coerced action list the tool itself uses, so
a near-miss shape cannot slip past. The old switches still mean "yes for
every chat" for configs that set them. These tools are kept off PasClaw's
MCP server, which has nobody to ask.

Needs you now describes a call with no resource by its arguments ("task:
create, title Add a search box, project shop") and wraps the reason.

Checked live with no flags in config: a desktop chat found task with
tool_search, the call waited in Needs you, Allow once ran it and the task
was on the board; with no desktop connected the same call was refused.
Unit-tested through the dispatcher and the MCP server; nine revert-checks
caught. Full make test passes; the replay bench is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T21:00:25.714958Z 7a1ec40 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a1ec40e8b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1935 to +1938
{ team_up is the operator's to allow, and was asked BEFORE this ran:
the tool loop's permission gate puts the question (DesktopConsent)
ahead of the publish, which is the point of no return -- the
connected desktop acts on it immediately. }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Enforce team consent for inbound MCP calls too

With a desktop connected and agent_tools_enabled off, an inbound HTTP MCP client can now call desktop with {"actions":[{"do":"team_up","brief":"build something"}]} and start autonomous agents without approval. TMCPServerCore.HandleToolsCall invokes FRegistry.RunTool directly, bypassing the tool loop's DesktopConsent check. The new MCP exclusion does not help because desktop has AskOutsideAgents = False and is categorized as read-only, so this also works on the default read-only MCP endpoint. Preserve an enforcement path for callers that do not pass through PermissionGate before publishing the command.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed in 5a4f7f8. The desktop tool is registered read-only, so the default MCP endpoint did expose it, and HandleToolsCall → RunTool never met DesktopConsent.

The fix: the tools now enforce consent themselves.

  • The gate marks its pass. When the tool loop's permission gate passes, it sets a per-thread mark (SetDispatchGatePassed) for exactly as long as the tool runs. It's saved and restored, so nested dispatch is safe.
  • The tools check the mark. The desktop tool refuses a team_up that didn't come through the gate, before it publishes. RunTool does the same for the board and agent tools when an ordinary caller reaches them some other way.
  • Unchanged: the old agent_tools_enabled switch still says yes in advance.

Also fixed while I was in there: OutsideAgentConsent exempted a standing agent's turn from every question, team_up included. A team member could start another team without asking. A team's own tools stay unasked for its members, but team_up is now asked on every turn.

Tests: projects_tests and team_board_tests cover a direct call (the MCP path) being refused in each shape, and a call that came through the gate with a yes running. I confirmed both fail if the fix is disabled.


Generated by Claude Code

from ToProviderDefs. Aliases go through RegisterHidden instead. }
Modified.Hidden := False;
Modified.CodeMode := False;
Modified.AskOutsideAgents := False;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve the consent flag when cloning subagent registries

When an ordinary chat uses spawn or spawn_background with the default general-purpose toolset (*), BuildFilteredRegistry copies the newly registered board and agent tools through CopyPreservingMode, which calls Register and clears their AskOutsideAgents flag here. Those tools consequently become ordinary, provider-visible tools in the child, and OutsideAgentConsent no longer asks or refuses their calls even though both configuration flags are off. Update the registry-copy path to preserve this registration mode so delegating work cannot silently grant powers that require consent in the parent chat.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed and fixed in 5a4f7f8. CopyPreservingMode preserved only CodeMode, so it re-registered the board and agent tools with plain Register and the child lost AskOutsideAgents.

The copy now calls RegisterAskOutsideAgents for those tools. A subagent spawned from a chat with * inherits the question, not the tool: it's absent from the child's provider list and asks like its parent would.

There's also a second guard independent of the copy: RunTool refuses those tools to an ordinary caller that didn't come through the permission gate.

Tested in team_board_tests (BuildFilteredRegistry(R, ['*']) keeps the mode, and the tool is not offered). The test fails with the fix disabled.


Generated by Claude Code

Codex on #624, two P1s, and a third found while fixing them:

- PasClaw's MCP server runs tools directly (RunTool), never meeting the
  tool loop's permission gate -- and the desktop tool is exposed
  read-only, so an MCP client could start a team with no question
  asked. The gate now marks the call it passed (a per-thread mark, set
  for exactly as long as the tool runs, nesting-safe), and the tools
  hold the line themselves: the desktop tool refuses a team_up that did
  not come through the gate, and RunTool refuses a standing agent's
  tool (board, agent) to an ordinary caller that did not.
- A subagent's registry is a copy, and CopyPreservingMode re-registered
  everything but code-mode tools plainly -- clearing AskOutsideAgents,
  so a chat could spawn its way past its own question. The copy now
  keeps the mode.
- OutsideAgentConsent exempted a standing agent's turn from every
  question, team_up included: a team member could start another team
  unasked. A team's own tools stay unasked for its members; starting a
  team is asked on every turn.

Tested: direct calls refused (registry and tool), a yes through the gate
still runs, the subagent copy keeps the question, a team member's
team_up asks; five revert-checks caught. Full make test passes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KYD1zZPD7GuM8pF1btwi2U
@FMXExpress
FMXExpress merged commit 5b27a53 into main Oct 30, 2026
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.

2 participants