Skip to content

feat(console): live operator console for watching and steering agents#4

Merged
denfry merged 1 commit into
mainfrom
feat/operator-console
Jun 14, 2026
Merged

feat(console): live operator console for watching and steering agents#4
denfry merged 1 commit into
mainfrom
feat/operator-console

Conversation

@denfry

@denfry denfry commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

Adds agent-sync console — a live, interactive view of the coordination layer. A streaming feed tails activity, inter-agent messages, presence changes, and lock events, while an operator> prompt lets a human act as a first-class participant: send messages/directives, lock files to stop edits immediately, drive the task board, and record decisions.

What's included

  • New agent_sync.console module. Pure logic (sanitize_terminal, parse_command, poll_events, execute_command, format_status) is import-clean and unit-tested without the TUI dependency; only run() touches prompt_toolkit, imported lazily.
  • Reserved operator identity registers as active (so its locks are enforced and its messages reach agents) but is filtered out of the "active agents" count in the renderers.
  • Live-messaging push hooks: UserPromptSubmit (gentle) and Stop (forceful) deliver undelivered messages into agent context, tracked by a new message_deliveries table; render_pushed_messages framing.
  • Terminal-injection defense: sanitize_terminal() strips control/ANSI bytes from agent-authored text before it reaches the human's terminal.
  • Optional [tui] extra (prompt_toolkit); the core stays dependency-free, with graceful fallbacks when the extra is missing or there is no TTY.
  • Docs & examples: README "Live console" section + commands/roadmap/safety updates, examples/CLAUDE.md operator note, examples/settings.json wired with the new hooks, and a console section in the dev smoke test.
  • CI/meta pass: CITATION.cff, LICENSE/__init__ wording, and a PyPI-publish guard in the release workflow.

Testing

  • pytest — 112 passed (incl. test_console.py, test_hooks_stop.py, test_hooks_user_prompt_submit.py).

🤖 Generated with Claude Code

Add `agent-sync console`: a live, interactive view of the coordination
layer. A streaming feed tails activity, inter-agent messages, presence
changes and lock events, while an `operator>` prompt lets a human act as
a first-class participant — send messages/directives, lock files to stop
edits immediately, drive the task board, and record decisions.

Console details:
- New `agent_sync.console` module. The pure logic (sanitize_terminal,
  parse_command, poll_events, execute_command, format_status) is import-
  clean and unit-tested without the TUI dependency; only `run()` touches
  prompt_toolkit, imported lazily.
- Reserved `operator` identity registers as active (so its locks are
  enforced and its messages reach agents) but is filtered out of the
  "active agents" count in the renderers.
- `messages.recent_messages()` provides the global feed; `sanitize_terminal()`
  strips control/ANSI bytes from agent-authored text before it reaches the
  human's terminal (terminal-injection defense).
- Optional `[tui]` extra (prompt_toolkit); the core stays dependency-free.
  Graceful fallbacks when the extra is missing or there is no TTY.
- Docs: README "Live console" section + commands/roadmap/safety updates,
  examples/CLAUDE.md operator note, and a console section in the dev smoke
  test.

Bundled pre-existing working-tree changes (committed together to keep the
tree green and tests passing):
- Live-messaging push: UserPromptSubmit (gentle) and Stop (forceful)
  hooks deliver undelivered messages into agent context, tracked by a new
  `message_deliveries` table; `render_pushed_messages` framing.
- Naming/positioning + CI/meta pass: CITATION.cff, LICENSE/__init__
  wording, and a PyPI-publish guard in the release workflow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@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: cdf322bbf2

ℹ️ 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 thread src/agent_sync/console.py
lines.append(f"locks ({len(live)}):")
for lk in live:
reason = f" — {sanitize_terminal(lk.reason)}" if lk.reason else ""
lines.append(f" {sanitize_terminal(lk.file_path)} → {_resolve_name(conn, lk.owner_agent_id)}{reason}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Sanitize owner names in console status

If an agent registers a name containing terminal control bytes and then owns a live lock, format_status() prints the resolved owner directly here, bypassing sanitize_terminal(). Running agent-sync console or the console status command will therefore emit raw escape sequences despite the new terminal-injection defense; sanitize the resolved owner before appending it.

Useful? React with 👍 / 👎.

}
]
}
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add SessionEnd to the skill-path hook sample

This no-PATH settings sample ends the hook list after Stop, unlike the PATH sample and installer output that include SessionEnd. Users who copy this variant will never call hook_session_end, so a closed Claude session remains active until the stale timeout and its locks/tasks can continue blocking other agents for that window.

Useful? React with 👍 / 👎.

@denfry denfry force-pushed the feat/operator-console branch from cdf322b to 11e60f5 Compare June 14, 2026 16:57
@denfry denfry merged commit 74bdd4c into main Jun 14, 2026
5 checks passed
@denfry denfry deleted the feat/operator-console branch June 14, 2026 18:12
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