brindle 0.3.19__tar.gz → 0.3.20__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. {brindle-0.3.19 → brindle-0.3.20}/PKG-INFO +4 -4
  2. {brindle-0.3.19 → brindle-0.3.20}/README.md +3 -3
  3. {brindle-0.3.19 → brindle-0.3.20}/pyproject.toml +1 -1
  4. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/agents.py +70 -19
  5. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/autopilot.py +34 -1
  6. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/cli.py +11 -4
  7. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/config.py +6 -1
  8. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/cull.py +18 -0
  9. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/db.py +16 -3
  10. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/mcp_server.py +6 -4
  11. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pipeline.py +60 -38
  12. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/providers.py +9 -1
  13. {brindle-0.3.19 → brindle-0.3.20}/.gitignore +0 -0
  14. {brindle-0.3.19 → brindle-0.3.20}/LICENSE +0 -0
  15. {brindle-0.3.19 → brindle-0.3.20}/SCHEDULE-A +0 -0
  16. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/__init__.py +0 -0
  17. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/__main__.py +0 -0
  18. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/account.py +0 -0
  19. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/airgap.py +0 -0
  20. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/antigravity.py +0 -0
  21. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/budget.py +0 -0
  22. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/__init__.py +0 -0
  23. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/backend-auditor.md +0 -0
  24. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/developer-codex.md +0 -0
  25. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/developer-fable.md +0 -0
  26. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/developer-gemini.md +0 -0
  27. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/developer-heavy.md +0 -0
  28. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/developer-light.md +0 -0
  29. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/developer-local.md +0 -0
  30. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/developer.md +0 -0
  31. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/qa.md +0 -0
  32. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/reviewer-codex.md +0 -0
  33. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/reviewer-gemini.md +0 -0
  34. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/reviewer-local.md +0 -0
  35. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/reviewer.md +0 -0
  36. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/subagent.md +0 -0
  37. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_agents/supervisor.md +0 -0
  38. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_rules/__init__.py +0 -0
  39. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_rules/security/backend.md +0 -0
  40. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_rules/style/minimal-diff.md +0 -0
  41. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/builtin_rules/tests/only.md +0 -0
  42. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/ci_adapters.py +0 -0
  43. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/ci_client.py +0 -0
  44. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/ci_federation.py +0 -0
  45. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/ci_hosts.py +0 -0
  46. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/cloud_credential.py +0 -0
  47. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/cloud_login.py +0 -0
  48. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/codemap.py +0 -0
  49. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/codemap_docs.py +0 -0
  50. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/codex_hook.py +0 -0
  51. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/company_identity.py +0 -0
  52. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/company_login.py +0 -0
  53. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/conflicts.py +0 -0
  54. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/cost.py +0 -0
  55. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/cost_estimate.py +0 -0
  56. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/demo.py +0 -0
  57. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/detect.py +0 -0
  58. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/doctor.py +0 -0
  59. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/escapes.py +0 -0
  60. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/events.py +0 -0
  61. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/gates.py +0 -0
  62. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/git.py +0 -0
  63. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/guardrails.py +0 -0
  64. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/history.py +0 -0
  65. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/identity_lock.py +0 -0
  66. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/inbox.py +0 -0
  67. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/key_check.py +0 -0
  68. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/keys_cmds.py +0 -0
  69. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/keystore.py +0 -0
  70. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/launch_health.py +0 -0
  71. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/learned_rules.py +0 -0
  72. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/learning.py +0 -0
  73. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/legacy.py +0 -0
  74. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/local_setup.py +0 -0
  75. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/login_pause.py +0 -0
  76. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/model_access.py +0 -0
  77. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/model_availability.py +0 -0
  78. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/native/__init__.py +0 -0
  79. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/native/client.py +0 -0
  80. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/native/loop.py +0 -0
  81. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/native/permissions.py +0 -0
  82. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/native/runner.py +0 -0
  83. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/native/serve.py +0 -0
  84. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/native/tools.py +0 -0
  85. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pane_auth.py +0 -0
  86. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/permissions.py +0 -0
  87. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/picker.py +0 -0
  88. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/plugins.py +0 -0
  89. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/policy.py +0 -0
  90. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pool.py +0 -0
  91. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pricing.py +0 -0
  92. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/__init__.py +0 -0
  93. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/_files.py +0 -0
  94. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/account.py +0 -0
  95. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/audit_chain.py +0 -0
  96. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/audit_export.py +0 -0
  97. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/auth.py +0 -0
  98. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/brief_learning.py +0 -0
  99. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/cost_centers.py +0 -0
  100. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/credentials.py +0 -0
  101. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/features.py +0 -0
  102. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/keys.py +0 -0
  103. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/learning.py +0 -0
  104. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/license.py +0 -0
  105. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/loopback.py +0 -0
  106. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/managed_models.py +0 -0
  107. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/org_profiles.py +0 -0
  108. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/orgkey.py +0 -0
  109. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/rollout.py +0 -0
  110. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/route_health.py +0 -0
  111. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/settings_sync.py +0 -0
  112. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/status.py +0 -0
  113. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/team_events.py +0 -0
  114. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/pro/team_policy.py +0 -0
  115. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/procs.py +0 -0
  116. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/profiles.py +0 -0
  117. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/prompt_answer.py +0 -0
  118. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/quota.py +0 -0
  119. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/repo_cmds.py +0 -0
  120. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/repos.py +0 -0
  121. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/rewind.py +0 -0
  122. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/rule_checks.py +0 -0
  123. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/savings.py +0 -0
  124. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/scratch.py +0 -0
  125. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/secrets.py +0 -0
  126. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/self_serve.py +0 -0
  127. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/services.py +0 -0
  128. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/sessions.py +0 -0
  129. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/sidebar_follow.py +0 -0
  130. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/signin_pause.py +0 -0
  131. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/status_cache.py +0 -0
  132. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/tasks.py +0 -0
  133. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/tmux.py +0 -0
  134. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/updates.py +0 -0
  135. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/upgrade.py +0 -0
  136. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/usage.py +0 -0
  137. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/view.py +0 -0
  138. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/watch.py +0 -0
  139. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/watch_costs.py +0 -0
  140. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/worker_models.py +0 -0
  141. {brindle-0.3.19 → brindle-0.3.20}/src/brindle/workspaces.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: brindle
3
- Version: 0.3.19
3
+ Version: 0.3.20
4
4
  Summary: Run coding agents in parallel, each on its own git branch, with a supervisor that delegates, reviews, and merges
5
5
  Project-URL: Homepage, https://pawdelta.com/brindle/
6
6
  Project-URL: Documentation, https://pawdelta.com/brindle/docs/recommended-use
@@ -94,7 +94,7 @@ uv tool install --editable ~/Projects/brindle # or from a local checkout
94
94
  brindle drives Claude Code, so you need that too (`npm install -g @anthropic-ai/claude-code`).
95
95
 
96
96
  `brindle --version` prints the installed version; the tmux status bar of every brindle
97
- session shows it too (`brindle 0.3.19`). A session started before an upgrade keeps
97
+ session shows it too (`brindle 0.3.20`). A session started before an upgrade keeps
98
98
  running the old code, and shows the old number, until you restart it.
99
99
 
100
100
  ## Quick start
@@ -368,7 +368,7 @@ your own status line prints, so what you see doesn't change.
368
368
  | | |
369
369
  |---|---|
370
370
  | `brindle` | a fresh supervisor chat here, dashboard alongside |
371
- | `brindle -s [CLI]` | pick the supervisor's CLI (no value: open the picker; `w` there picks worker models); remembered for next time |
371
+ | `brindle -s [CLI]` | pick the supervisor's CLI (no value: open the picker; `w` there picks worker models); a picker choice is remembered, a named CLI is for this run only |
372
372
  | `brindle supervisor` | the same, with `--branch`/`--worktree` to run it in another worktree |
373
373
  | `brindle init` | detect setup and test commands, write `.brindle/config.json`, check tools |
374
374
  | `brindle demo [--local]` | watch brindle finish a tiny practice repo: parallel workers, reviews, gated merges |
@@ -562,7 +562,7 @@ Autopilot, merge gates and cleanup:
562
562
  | `pre_commit` | `true` | run [pre-commit](https://pre-commit.com) over the branch, if the repo uses it |
563
563
  | `max_agents` | `4` | workers running at once per session (`0`: no cap) |
564
564
  | `check_timeout` | `900` | seconds each check may take |
565
- | `check_concurrency` | `2` | check runs at once on this machine, across branches; the rest wait their turn (`0`: no cap). A run far past its last duration is reported to the supervisor |
565
+ | `check_concurrency` | `4` | check runs at once on this machine, across branches; the rest wait their turn (`0`: no cap). A run far past its last duration is reported to the supervisor |
566
566
  | `fable_escalation` | on, unless the worker runs on a cloud account (Bedrock, Vertex or Foundry) | retry a failed heavy task once on `developer-heavy` before handing it to you; `true` turns it on for a cloud account, `false` off |
567
567
  | `usage_limit` | `90` | autopilot stops pushing on at this % of your Claude usage limit |
568
568
  | `limit_cooldown_minutes` | `300` for Antigravity | how long a provider that hit its limit counts as unavailable |
@@ -63,7 +63,7 @@ uv tool install --editable ~/Projects/brindle # or from a local checkout
63
63
  brindle drives Claude Code, so you need that too (`npm install -g @anthropic-ai/claude-code`).
64
64
 
65
65
  `brindle --version` prints the installed version; the tmux status bar of every brindle
66
- session shows it too (`brindle 0.3.19`). A session started before an upgrade keeps
66
+ session shows it too (`brindle 0.3.20`). A session started before an upgrade keeps
67
67
  running the old code, and shows the old number, until you restart it.
68
68
 
69
69
  ## Quick start
@@ -337,7 +337,7 @@ your own status line prints, so what you see doesn't change.
337
337
  | | |
338
338
  |---|---|
339
339
  | `brindle` | a fresh supervisor chat here, dashboard alongside |
340
- | `brindle -s [CLI]` | pick the supervisor's CLI (no value: open the picker; `w` there picks worker models); remembered for next time |
340
+ | `brindle -s [CLI]` | pick the supervisor's CLI (no value: open the picker; `w` there picks worker models); a picker choice is remembered, a named CLI is for this run only |
341
341
  | `brindle supervisor` | the same, with `--branch`/`--worktree` to run it in another worktree |
342
342
  | `brindle init` | detect setup and test commands, write `.brindle/config.json`, check tools |
343
343
  | `brindle demo [--local]` | watch brindle finish a tiny practice repo: parallel workers, reviews, gated merges |
@@ -531,7 +531,7 @@ Autopilot, merge gates and cleanup:
531
531
  | `pre_commit` | `true` | run [pre-commit](https://pre-commit.com) over the branch, if the repo uses it |
532
532
  | `max_agents` | `4` | workers running at once per session (`0`: no cap) |
533
533
  | `check_timeout` | `900` | seconds each check may take |
534
- | `check_concurrency` | `2` | check runs at once on this machine, across branches; the rest wait their turn (`0`: no cap). A run far past its last duration is reported to the supervisor |
534
+ | `check_concurrency` | `4` | check runs at once on this machine, across branches; the rest wait their turn (`0`: no cap). A run far past its last duration is reported to the supervisor |
535
535
  | `fable_escalation` | on, unless the worker runs on a cloud account (Bedrock, Vertex or Foundry) | retry a failed heavy task once on `developer-heavy` before handing it to you; `true` turns it on for a cloud account, `false` off |
536
536
  | `usage_limit` | `90` | autopilot stops pushing on at this % of your Claude usage limit |
537
537
  | `limit_cooldown_minutes` | `300` for Antigravity | how long a provider that hit its limit counts as unavailable |
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "brindle"
3
- version = "0.3.19"
3
+ version = "0.3.20"
4
4
  description = "Run coding agents in parallel, each on its own git branch, with a supervisor that delegates, reviews, and merges"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1418,15 +1418,34 @@ def unread_notice(db: DB, messages: list) -> str:
1418
1418
  f"(from {', '.join(senders)}). Call read_messages.")
1419
1419
 
1420
1420
 
1421
+ def one_line(db: DB, message_id: int, body: str, sender_id: str | None) -> str:
1422
+ """A message as the single line a supervisor sees: sender, head line (the
1423
+ first line of ``body``) and how to fetch the rest."""
1424
+ if sender_id:
1425
+ sender = db.get_agent(sender_id)
1426
+ who = f"{sender.profile} {sender_id}" if sender else sender_id
1427
+ else:
1428
+ who = "brindle"
1429
+ head = first_line(body, 300)
1430
+ if not sender_id:
1431
+ head = head.removeprefix("[brindle] ") # the sender tag already says it
1432
+ return (f"[{who}] {head} "
1433
+ f"(full text: read_messages(message_id={message_id}))")
1434
+
1435
+
1436
+ def full_message(db: DB, agent_id: str, message_id: int) -> str:
1437
+ """The whole text of one message to ``agent_id``, as read_messages(message_id=...) returns it."""
1438
+ m = db.get_message(agent_id, message_id)
1439
+ if m is None:
1440
+ return f"No message {message_id}."
1441
+ if m.sender_id:
1442
+ return format_message(db, m.body, m.sender_id)
1443
+ return f"<details><summary>Message from brindle</summary>\n\n{m.body}\n</details>"
1444
+
1445
+
1421
1446
  def render_unread(db: DB, messages: list) -> str:
1422
- """What read_messages returns: each message with its trust lead line."""
1423
- parts = []
1424
- for m in messages:
1425
- if m.sender_id:
1426
- parts.append(m.body) # stored through format_message: sender and reply hint
1427
- else:
1428
- parts.append(f"<details><summary>Message from brindle</summary>\n\n{m.body}\n</details>")
1429
- return "\n\n".join(parts)
1447
+ """What read_messages returns: one line per message."""
1448
+ return "\n".join(one_line(db, m.id, m.body, m.sender_id) for m in messages)
1430
1449
 
1431
1450
 
1432
1451
  def send_message(db: DB, to_id: str, body: str, sender_id: str | None = None,
@@ -1440,20 +1459,25 @@ def send_message(db: DB, to_id: str, body: str, sender_id: str | None = None,
1440
1459
  identity_lock.ensure(agent)
1441
1460
  if not person and runs_process(agent) and is_alive(agent) and pulls_messages(db, agent):
1442
1461
  # Keep the message unread and deliver only a notice, once for everything unread.
1443
- db.enqueue_held(agent.id, format_message(db, body, sender_id), sender_id)
1462
+ db.enqueue_held(agent.id, body, sender_id)
1444
1463
  claimed = db.claim_notice(agent.id)
1445
1464
  if claimed is None:
1446
1465
  return "queued"
1447
1466
  try:
1448
- outcome = _send_message(db, agent, unread_notice(db, claimed), None)
1467
+ outcome = _send_message(db, agent, unread_notice(db, claimed), None, notice=True)
1449
1468
  except BaseException:
1450
1469
  db.reset_notice(agent.id)
1451
1470
  raise
1452
1471
  return outcome
1453
- return _send_message(db, agent, body, sender_id)
1472
+ # A supervisor sees a message from an agent or brindle as one line; the
1473
+ # person's own input is always delivered whole.
1474
+ return _send_message(db, agent, body, sender_id,
1475
+ condensed=agent.mode == "interactive" and not person
1476
+ and agent.provider != "shell")
1454
1477
 
1455
1478
 
1456
- def _send_message(db: DB, agent: Agent, body: str, sender_id: str | None) -> str:
1479
+ def _send_message(db: DB, agent: Agent, body: str, sender_id: str | None,
1480
+ condensed: bool = False, notice: bool = False) -> str:
1457
1481
  if not runs_process(agent):
1458
1482
  raise AgentError(
1459
1483
  f"agent {agent.id} is a subagent run by its supervisor's own Agent tool, so brindle "
@@ -1466,8 +1490,14 @@ def _send_message(db: DB, agent: Agent, body: str, sender_id: str | None) -> str
1466
1490
  "can resume its session with `brindle continue`; the message isn't kept.")
1467
1491
  raise AgentError(f"agent {agent.id} is not running")
1468
1492
  provider = get_provider(agent.provider)
1469
- text = format_message(db, body, sender_id)
1470
- if agent.provider == "antigravity":
1493
+ if condensed:
1494
+ # The full text is kept, already read, for read_messages(message_id=...).
1495
+ kept = db.enqueue_held(agent.id, body, sender_id)
1496
+ db.mark_delivered(kept)
1497
+ text = one_line(db, kept, body, sender_id)
1498
+ else:
1499
+ text = format_message(db, body, sender_id)
1500
+ if agent.provider == "antigravity" and not (condensed or notice):
1471
1501
  from brindle.antigravity import format_delivered_message
1472
1502
  text = format_delivered_message(text)
1473
1503
  if agent.headless:
@@ -1479,7 +1509,7 @@ def _send_message(db: DB, agent: Agent, body: str, sender_id: str | None) -> str
1479
1509
  tmux.paste(agent.tmux_window, text, lead=message_lead(db, agent, sender_id),
1480
1510
  server=server_of(agent))
1481
1511
  return "delivered"
1482
- message_id = db.enqueue(agent.id, text, sender_id)
1512
+ message_id = db.enqueue(agent.id, text, sender_id, notice=notice)
1483
1513
  from brindle import login_pause
1484
1514
 
1485
1515
  if login_pause.holding(db, agent.id):
@@ -1644,7 +1674,8 @@ def flush(db: DB, agent_id: str) -> bool:
1644
1674
  delivered = True
1645
1675
  launch_health.delivered(db, agent, baseline)
1646
1676
  else:
1647
- db.enqueue(agent_id, msg.body, msg.sender_id) # back in the queue, for the pane
1677
+ db.enqueue(agent_id, msg.body, msg.sender_id, # back in the queue, for the pane
1678
+ notice=msg.noticed_at is not None)
1648
1679
  break
1649
1680
  if delivered:
1650
1681
  return True
@@ -1743,6 +1774,19 @@ def complete_subagent(db: DB, agent_id: str, result: str) -> Agent:
1743
1774
  return db.get_agent(agent.id) or agent
1744
1775
 
1745
1776
 
1777
+ def first_line(text: str, limit: int = 160) -> str:
1778
+ """The first non-empty line of ``text``, cut to ``limit`` characters."""
1779
+ line = next((ln.strip() for ln in text.splitlines() if ln.strip()), "")
1780
+ return line if len(line) <= limit else line[: limit - 1].rstrip() + "…"
1781
+
1782
+
1783
+ def condense(head: str, *body: str) -> str:
1784
+ """A message that opens with the one-line ``head`` and keeps the long
1785
+ ``body`` sections inside a collapsible block."""
1786
+ return (f"{head}\n\n<details><summary>Details</summary>\n\n"
1787
+ + "\n\n".join(b for b in body if b) + "\n\n</details>")
1788
+
1789
+
1746
1790
  def report_result(db: DB, agent_id: str, result: str, forward: bool = True,
1747
1791
  removed: tuple[Agent, Workspace] | None = None) -> str:
1748
1792
  """Record a worker's or reviewer's result. A piped worker's report goes
@@ -1794,7 +1838,7 @@ def report_result(db: DB, agent_id: str, result: str, forward: bool = True,
1794
1838
  where = f" on branch `{ws.branch}` (workspace {ws.id})" if ws else ""
1795
1839
  send_message(
1796
1840
  db, agent.parent_id,
1797
- f"Assigned task finished{where}.\n\n{forwarded}",
1841
+ condense(f"Assigned task finished{where}: {first_line(result)}", forwarded),
1798
1842
  sender_id=agent.id,
1799
1843
  )
1800
1844
  return "result recorded and sent to your supervisor"
@@ -2712,7 +2756,10 @@ def _stop_decision(db: DB, agent: Agent, payload: dict, via_inbox: bool = False)
2712
2756
  decision = pilot.on_stop(db, agent, payload)
2713
2757
  if decision:
2714
2758
  db.set_status(agent.id, "processing")
2715
- return decision
2759
+ # Claude Code shows the reason in the chat: one line, like any brindle message.
2760
+ kept = db.enqueue_held(agent.id, decision["reason"], None)
2761
+ db.mark_delivered(kept)
2762
+ return {**decision, "reason": one_line(db, kept, decision["reason"], None)}
2716
2763
  db.set_status(agent.id, "idle")
2717
2764
  return None
2718
2765
 
@@ -2868,7 +2915,11 @@ def handle_hook(db: DB, agent_id: str, event: str, payload: dict) -> dict | None
2868
2915
 
2869
2916
  decision = pilot.on_stop(db, agent, payload)
2870
2917
  if decision:
2871
- db.enqueue(agent_id, decision["reason"], None)
2918
+ # Like any message from brindle: one line (or a notice), the rest via read_messages.
2919
+ try:
2920
+ send_message(db, agent_id, decision["reason"])
2921
+ except AgentError:
2922
+ pass # gone since its turn ended: nobody to nudge
2872
2923
  if (agent.mode in REPORTING_MODES and agent.result is None
2873
2924
  and not db.pending_count(agent_id)):
2874
2925
  # No Stop hook can remind it to report, and no hook says when
@@ -101,6 +101,9 @@ to be asked each step.
101
101
  the checks pass, merges it and removes the worktree; you get one message
102
102
  per branch: merged, or "needs you" with the details. Don't request_review
103
103
  or merge_workspace a reported branch yourself unless brindle says so.
104
+ - Messages reach you as one line each; read_messages(message_id=N) gives the
105
+ full text only when you need it. Relay worker results to the user in one line.
106
+ Reply to an agent with send_message(to_agent_id=<sender id>).
104
107
  - After merging, call `check_milestone`. Only brindle's check marks a milestone
105
108
  done: never claim one is done yourself. When every milestone passes, brindle
106
109
  audits the work against the goal; the goal is reached only when that audit
@@ -1293,7 +1296,7 @@ def check_milestones(db: DB, root_id: str, ws: Workspace, position: int | None =
1293
1296
  if m.output and m.status == "failed":
1294
1297
  lines.append(f"\nMilestone {m.position} check output:\n{m.output}")
1295
1298
  if done and audit is None:
1296
- lines.append("\nEvery milestone's check passes: the goal is reached. Tell the user.")
1299
+ lines.append("\n" + GOAL_REACHED)
1297
1300
  clear_finished_goal(db, root_id)
1298
1301
  elif done:
1299
1302
  lines.append("\n" + AUDIT_HOLD[audit].format(note=(ap.note if ap else None) or ""))
@@ -1307,6 +1310,7 @@ def check_milestones(db: DB, root_id: str, ws: Workspace, position: int | None =
1307
1310
  # adversarial reviewer compares the work with the original goal before the
1308
1311
  # goal counts as reached (``goal_audit`` in .brindle/config.json turns it off).
1309
1312
 
1313
+ GOAL_REACHED = "Every milestone's check passes: the goal is reached. Tell the user."
1310
1314
  AUDIT_HOLD = {
1311
1315
  "start": ("Every milestone's check passes. Before the goal counts as reached, an independent "
1312
1316
  "auditor is checking the work against the original goal; its verdict arrives as a "
@@ -1561,6 +1565,35 @@ def progress(db: DB, root_id: str) -> str:
1561
1565
  return "\n".join(lines)
1562
1566
 
1563
1567
 
1568
+ def check_summary(db: DB, root_id: str, position: int | None, text: str) -> str:
1569
+ """The one line pushed after a milestone check: the result, how many
1570
+ milestones are verified, and a REGRESSED note. ``text`` is what
1571
+ check_milestones returned; the full progress stays in get_progress."""
1572
+ from brindle.agents import first_line
1573
+
1574
+ ms = db.milestones(root_id)
1575
+ done, total = counts(db, root_id)
1576
+ if not ms:
1577
+ return first_line(text)
1578
+ chosen = [m for m in ms if position is None or m.position == position]
1579
+ parts = []
1580
+ for m in chosen if position is not None else [m for m in ms if m.status == "failed"]:
1581
+ if m.status == "failed":
1582
+ parts.append(f"Milestone {m.position} ✗ failed: {first_line(m.output or 'no output')}")
1583
+ else:
1584
+ parts.append(f"Milestone {m.position} {MARK.get(m.status, '·')} {m.status}")
1585
+ head = "; ".join(parts) or "Milestone check"
1586
+ head += f" ({done} of {total} verified)"
1587
+ first = text.splitlines()[0] if text else ""
1588
+ if first.startswith("REGRESSED:"):
1589
+ head += f". {first}"
1590
+ if GOAL_REACHED in text.splitlines():
1591
+ head += ". Goal reached: tell the user"
1592
+ elif ms and done == total:
1593
+ head += ". Not done yet: completion audit pending, has gaps, or needs a commit"
1594
+ return head
1595
+
1596
+
1564
1597
  # -- workers and the cap ----------------------------------------------------------
1565
1598
 
1566
1599
 
@@ -418,7 +418,8 @@ def _can_prompt(yes: bool = False, demo: bool = False) -> bool:
418
418
  def _resolve_supervisor(repo_root: str | None, provider: Optional[str], *,
419
419
  yes: bool = False, demo: bool = False) -> Optional[str]:
420
420
  """The CLI the supervisor runs on (None: its profile's). ``-s CLI`` picks
421
- it and is remembered; a bare ``-s`` opens the picker. Otherwise the
421
+ it for this run only; a bare ``-s`` opens the picker, whose choice is
422
+ remembered. Otherwise the
422
423
  person's last pick, asked again in the picker only on the first launch or
423
424
  when that pick isn't signed in or allowed, and only where brindle may ask.
424
425
  A CLI the org doesn't allow this person is refused, whichever way it came."""
@@ -436,11 +437,13 @@ def _resolve_supervisor(repo_root: str | None, provider: Optional[str], *,
436
437
  raise typer.Exit(1)
437
438
  return chosen
438
439
 
440
+ from_picker = False
439
441
  if provider == picker.PICK:
440
442
  if not _can_prompt(yes, demo):
441
443
  _fail("`brindle -s` on its own opens the supervisor picker, which needs a terminal; "
442
444
  "name the CLI instead, e.g. `brindle -s codex`")
443
445
  provider = ask()
446
+ from_picker = True
444
447
  elif provider:
445
448
  why = acc.refusal(provider)
446
449
  if why:
@@ -451,6 +454,7 @@ def _resolve_supervisor(repo_root: str | None, provider: Optional[str], *,
451
454
  elif _can_prompt(yes, demo) and not (pick and acc.allows(pick)
452
455
  and pick in doctor_mod.signed_in_providers()):
453
456
  provider = ask()
457
+ from_picker = True
454
458
  elif pick and acc.allows(pick):
455
459
  provider = pick
456
460
  final = provider or _run(load_profile, agents.SUPERVISOR, repo_root).provider
@@ -458,9 +462,10 @@ def _resolve_supervisor(repo_root: str | None, provider: Optional[str], *,
458
462
  if why:
459
463
  _fail(f"can't run the supervisor on {final}: {why}. Pick another with `brindle -s`.")
460
464
  if provider:
461
- if provider != pick:
465
+ # only the interactive picker saves a choice; a -s flag is this session's override
466
+ if from_picker and provider != pick:
462
467
  set_user(SUPERVISOR_KEY, provider)
463
- typer.echo(f"Supervisor: {provider} (your pick) · brindle -s to change")
468
+ typer.echo(f"Supervisor: {provider} ({'your pick' if from_picker else 'this run'}) · brindle -s to change")
464
469
  return provider
465
470
 
466
471
 
@@ -2950,8 +2955,10 @@ def check_milestones_cmd(root_id: str, workspace_id: str,
2950
2955
  try:
2951
2956
  text = autopilot.check_milestones(db, root_id, ws, position)
2952
2957
  record_milestone_changes(db, root_id, ws, before, root, position, text)
2958
+ head = autopilot.check_summary(db, root_id, position, text)
2953
2959
  except Exception as e: # noqa: BLE001 - the supervisor must hear about it either way
2954
2960
  text = f"The milestone check failed to run: {e}"
2961
+ head = agents.first_line(text)
2955
2962
  try:
2956
2963
  autopilot.start_audit(db, root_id, ws)
2957
2964
  except Exception as e: # noqa: BLE001
@@ -2963,7 +2970,7 @@ def check_milestones_cmd(root_id: str, workspace_id: str,
2963
2970
  db.update_autopilot(root_id, checking_since=None)
2964
2971
  if db.get_agent(root_id) is None:
2965
2972
  return
2966
- body = f"[brindle] Milestone check finished.\n\n{text}"
2973
+ body = agents.condense(f"[brindle] {head}", text + "\n\n(The same progress, any time: get_progress.)")
2967
2974
  try:
2968
2975
  agents.send_message(db, root_id, body)
2969
2976
  except (agents.AgentError, tmux.TmuxError):
@@ -10,6 +10,7 @@ from __future__ import annotations
10
10
 
11
11
  import json
12
12
  import os
13
+ import sys
13
14
  from dataclasses import dataclass, field
14
15
  from pathlib import Path
15
16
 
@@ -94,7 +95,7 @@ class RepoConfig:
94
95
  pre_commit: bool = True # run pre-commit (the framework) over a branch before merging
95
96
  max_agents: int = 5 # workers running at once per session; 0 means no cap
96
97
  check_timeout: int = 900 # seconds allowed for each check command
97
- check_concurrency: int = 2 # check runs at once on this machine, across branches; the rest queue (0: no cap)
98
+ check_concurrency: int = 4 # check runs at once on this machine, across branches; the rest queue (0: no cap)
98
99
  usage_limit: int = 90 # autopilot stops pushing on at this % of the Claude usage limit
99
100
  limit_cooldown_minutes: int | None = None # how long a provider that hit its limit counts as unavailable (default 300 for Antigravity)
100
101
  graphify: bool | None = None # point agents at graphify-out/graph.json (None: if it's there)
@@ -327,6 +328,10 @@ def supervisor_pick() -> str | None:
327
328
  def set_user(key: str, value: object) -> Path:
328
329
  """Set one key in ``~/.brindle/config.json`` (other keys are kept)."""
329
330
  path = user_config_path()
331
+ if os.environ.get("BRINDLE_AGENT_ID"):
332
+ # A brindle agent's CLI call must not change the person's own settings.
333
+ print("brindle: running as an agent, so ~/.brindle/config.json was not changed", file=sys.stderr)
334
+ return path
330
335
  path.parent.mkdir(parents=True, exist_ok=True)
331
336
  data = _read_json(path)
332
337
  data[key] = value
@@ -49,6 +49,9 @@ from brindle.pro import route_health
49
49
 
50
50
  # An agent this new may not have its window recorded yet.
51
51
  LAUNCH_GRACE = 60.0
52
+ # How long a message waits for its normal delivery (a hook, the start-up
53
+ # flush) before a sweep retries it.
54
+ FLUSH_RETRY_AFTER = 30.0
52
55
 
53
56
 
54
57
  def _root(db: DB, a: Agent) -> str:
@@ -202,6 +205,21 @@ def sweep(db: DB, now: float | None = None) -> list[str]:
202
205
  done.append(f"closed {'idle' if finished else 'stopped'} worker {a.id} "
203
206
  f"after {int(idle_for // 60)} min")
204
207
 
208
+ # 2b. Messages a flush left queued because the pane wasn't ready (the
209
+ # person typing, say): an idle agent with no turn-end hook (agy), or one
210
+ # just waiting, would never get them otherwise. flush itself still waits
211
+ # for typed input, a held login, and claims the agent before pasting.
212
+ for a in db.list_agents():
213
+ oldest = db.oldest_pending(a.id)
214
+ if (oldest is not None and now - oldest >= FLUSH_RETRY_AFTER and a.status == "idle"
215
+ and not a.headless and a.dismissed_at is None and agents.runs_process(a)
216
+ and here(a) and alive(a)):
217
+ try:
218
+ if agents.flush(db, a.id):
219
+ done.append(f"delivered a queued message to {a.id}")
220
+ except (agents.AgentError, tmux.TmuxError):
221
+ pass # stays queued for the next sweep
222
+
205
223
  # 3. Launches stopped on a startup prompt; workers stuck on a prompt
206
224
  # nobody is answering, or gone silent.
207
225
  done.extend(settle_startups(db, now, panes))
@@ -1056,11 +1056,15 @@ class DB:
1056
1056
 
1057
1057
  # -- inbox -------------------------------------------------------------
1058
1058
 
1059
- def enqueue(self, agent_id: str, body: str, sender_id: str | None) -> int:
1059
+ def enqueue(self, agent_id: str, body: str, sender_id: str | None,
1060
+ notice: bool = False) -> int:
1061
+ """Queue ``body`` for delivery. ``notice``: it is a pull-mode "new
1062
+ messages" notice (noticed_at set), dropped once those are read (read_held)."""
1063
+ now = time.time()
1060
1064
  with self.tx() as c:
1061
1065
  cur = c.execute(
1062
- "INSERT INTO inbox (agent_id, sender_id, body, created_at) VALUES (?,?,?,?)",
1063
- (agent_id, sender_id, body, time.time()),
1066
+ "INSERT INTO inbox (agent_id, sender_id, body, created_at, noticed_at) VALUES (?,?,?,?,?)",
1067
+ (agent_id, sender_id, body, now, now if notice else None),
1064
1068
  )
1065
1069
  return int(cur.lastrowid)
1066
1070
 
@@ -1157,6 +1161,12 @@ class DB:
1157
1161
  )
1158
1162
  return int(cur.lastrowid)
1159
1163
 
1164
+ def get_message(self, agent_id: str, message_id: int) -> Message | None:
1165
+ row = self.conn.execute(
1166
+ "SELECT * FROM inbox WHERE id=? AND agent_id=?", (message_id, agent_id)
1167
+ ).fetchone()
1168
+ return _load(Message, row) if row else None
1169
+
1160
1170
  def unread(self, agent_id: str) -> list[Message]:
1161
1171
  rows = self.conn.execute(
1162
1172
  "SELECT * FROM inbox WHERE agent_id=? AND held=1 AND delivered_at IS NULL ORDER BY id",
@@ -1233,6 +1243,9 @@ class DB:
1233
1243
  (time.time(), agent_id),
1234
1244
  )
1235
1245
  c.execute("UPDATE agents SET stop_reminded_at=NULL WHERE id=?", (agent_id,))
1246
+ # A notice still queued announces only what was just read: it would wake the agent for nothing.
1247
+ c.execute("DELETE FROM inbox WHERE agent_id=? AND COALESCE(held,0)=0 "
1248
+ "AND delivered_at IS NULL AND noticed_at IS NOT NULL", (agent_id,))
1236
1249
  return [_load(Message, r) for r in rows]
1237
1250
 
1238
1251
  def message_delivered(self, message_id: int) -> bool:
@@ -510,14 +510,16 @@ def send_message(to_agent_id: str, message: str) -> str:
510
510
 
511
511
 
512
512
  @mcp.tool()
513
- def read_messages() -> str:
514
- """Read your unread messages from agents and brindle (marks them read). Call
515
- it when a "brindle (HH:MM:SS): N new messages" notice arrives, or when you're about to
516
- stop."""
513
+ def read_messages(message_id: int = 0) -> str:
514
+ """Read your unread messages from agents and brindle (marks them read), one
515
+ line each. Call it when a "brindle (HH:MM:SS): N new messages" notice arrives, or
516
+ when you're about to stop. message_id: return that message's full text instead."""
517
517
  db = DB()
518
518
  caller, _ = _caller(db)
519
519
  if not caller:
520
520
  return "Not running as a brindle agent; no messages."
521
+ if message_id:
522
+ return agents.full_message(db, caller.id, message_id)
521
523
  found = db.read_held(caller.id)
522
524
  if not found:
523
525
  return "No unread messages."