Skip to content

Add project-root context binding for agent identification#9

Merged
sebastientaggart merged 1 commit intomainfrom
feature/agent-context-binding
Apr 6, 2026
Merged

Add project-root context binding for agent identification#9
sebastientaggart merged 1 commit intomainfrom
feature/agent-context-binding

Conversation

@sebastientaggart
Copy link
Copy Markdown
Member

Summary

Adds project context (project_root, active_file) to agents so multiple instances of the same agent type can be distinguished by workspace. The OpenDeck plugin now displays context-aware labels like "claude-code: my-project" instead of generic IDs like "mock-1".

Changes

  • AgentBase: New project_root and active_file fields, plus a display_label property that derives a human-friendly label from the project root.
  • API: New POST /agents/register (register external agents with context) and PATCH /agents/{id}/context (update context, emits agent.context_changed event).
  • Bridge: register_agent() and update_agent_context() HTTP client methods.
  • OpenDeck plugin: agent_status and agent_dashboard handlers use display_label and listen for agent.context_changed events.
  • Tests: 5 new tests covering registration, duplicate detection, context updates, 404 handling, and label fallback.

Drive-by fixes (in scope per user request)

  • Makefile: uv run uvicornuv run python -m uvicorn (binary entry-point wasn't resolvable).
  • Config auto-discovery: Settings now auto-loads ./config.toml if DECKHAND_CONFIG_FILE isn't set.
  • Dropped legacy api_key field: only api_keys = [...] is supported now (unreleased software, no migration needed).
  • .gitignore: added config.toml to prevent committing local secrets.

Closes #2

@sebastientaggart sebastientaggart linked an issue Apr 6, 2026 that may be closed by this pull request
@sebastientaggart
Copy link
Copy Markdown
Member Author

Review Summary

Verdict: APPROVE

Findings

  • [NOTE] register_agent defines ExternalAgent as a nested class inside the route handler. It works, but hoisting it to module scope (or deckhand/agents/external.py) would avoid redefining the class on every request and make it reusable. Non-blocking.
  • [NOTE] display_label uses rstrip("/") + rsplit("/", 1), which is POSIX-only. On Windows paths with backslashes the label would fall back to the full string. Not a concern for the current deployment target.
  • [NOTE] Dropping the legacy api_key field is a breaking change; PR description acknowledges this is pre-release so acceptable.

No correctness, security, or platform-compliance issues found. Tests cover the new endpoints (register/duplicate/update/404/fallback label) and the existing list test was extended to assert context fields.

@sebastientaggart sebastientaggart merged commit 32c9108 into main Apr 6, 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.

Add project-root context binding for agent identification

1 participant