Skip to content

feat: allow third-party agents to be saved and pinned (#592) - #1056

Open
Ohualtex wants to merge 4 commits into
Louis-CFM:mainfrom
Ohualtex:feat/issue-592-custom-agents
Open

Ohualtex wants to merge 4 commits into
Louis-CFM:mainfrom
Ohualtex:feat/issue-592-custom-agents

Conversation

@Ohualtex

@Ohualtex Ohualtex commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves #592 (Let third-party agents (coucou_agent) be declared in Active pills so their pill persists).

Coucou already handles hook events from third-party agents, but previously any uncataloged agent pill only existed for the duration of its live session. Users could not persist external agents, pin them to the island when idle, or configure personal preferences (display name, custom color) across app restarts.

This PR introduces end-to-end custom agent support across the Rust backend, TypeScript island state, and the Settings window—preserving Coucou's existing minimalist theme, 4-slot limit, and multi-window consistency.


Key Capabilities

  1. Persistent Registration & Cold Boot Rehydration:

    • External agents (coucou_agent or --agent <id>) can be registered with an ID (^[a-z0-9_-]+$, max 24 chars) and an optional custom display name.
    • Pinned custom agents rehydrate as idle tasks on cold boot (State.loadIntegrationTasks).
    • Pure resolution (resolvePill, sanitizeDeclared, availablePills) guarantees built-in catalog precedence while ensuring registered custom agents are not stripped.
  2. In-Island Pinning:

    • Expanded agent cards on the island feature a subtle pin button (.icon-btn.pin-btn) to save and pin the agent directly without navigating to Settings.
    • Enforces the 4-slot auxiliary limit; if all slots are full, saves the agent to custom agents and prompts the user without crashing or clobbering slots.
  3. Active Pills Settings & LRU Discovery:

    • Custom Agents Section: Displays registered agents with clickable color picker (pillColors), display name, pin toggle, and delete action.
    • Recent Discovery Badges: In-memory LRU-5 discovery pool surfaces recently observed agent tags with one-click [+ Add] and [✕ Dismiss] chips.
    • Manual Registration Form: Clean inline inputs with validation for manual agent definition.
  4. Multi-Window Synchronization & Concurrency Safety:

    • custom_agent_save and custom_agent_forget use a strict write-then-commit sequence (disk write validated before in-memory commit).
    • save_settings protects custom_agents and their associated active_integrations / pill_colors from being overwritten by stale webview snapshots.
    • Monotonic sequence numbers (seq) prevent stale discovery state updates across windows.
  5. Visual Teardown Protection & Concurrent Sessions:

    • Targeted Teardown Deferral (pendingRemovals): When an unpinned agent session stops, the card is not abruptly destroyed while actively inspected in the expanded island. Removal cleanly defers until the island folds or focus changes.
    • Multi-Session Safety: Concurrent terminal sessions for the same agent are tracked (activeSessions); ending one session does not interrupt active sibling sessions.
  6. Localization:

    • Complete 13-language translations added in extra.json (English, French, German, Spanish, Turkish, Chinese, Japanese, Korean, Hindi, etc.).

Verification & Test Suite

  • Rust Backend: All 565 tests passing (cargo test --manifest-path windows/src-tauri/Cargo.toml).
  • TypeScript Core & UI: All 534 tests passing (npm test), including 13 new comprehensive unit tests in windows/tests/custom-agents.test.mjs.
  • Total: 1099 automated tests passing 100% green with zero regressions.
  • Strict adherence to Coucou's design system (style.css), no foreign styles or external UI dependencies introduced.

Closes #592.

@Ohualtex
Ohualtex force-pushed the feat/issue-592-custom-agents branch 2 times, most recently from 0408cb2 to 461b22a Compare November 13, 2026 11:54
…s-CFM#592)

- Define CustomAgent in settings with custom_agents array
- Implement custom_agent_save and custom_agent_forget with write-then-commit order
- Protect custom agents and active integrations from stale save_settings snapshots
- Add in-memory LRU-5 discovery pool with monotonic seq tracking
- Support underscore in agent_id validation (^[a-z0-9_-]+$) in recap.rs
- Separate explicit invalid tags from Claude Code attribution
… tracking (Louis-CFM#592)

- Support underscore in agent validation regex (^[a-z0-9_-]+$)
- Add resolvePill, availablePills, and sanitizeDeclared with custom agents support
- Hydrate pinned custom agents on cold boot in State.loadIntegrationTasks
- Add targeted visual teardown protection (pendingRemovals) for actively viewed cards
- Protect concurrent multi-session agent execution in hooks
- Expose custom agent commands in Bridge
…ement (Louis-CFM#592)

- Add pin icon button to expanded island overview card
- Add Custom Agents group to Settings -> Active Pills with color picker, pin toggle, and delete
- Render discovered agents chips with add and dismiss actions
- Add manual agent registration form with ID validation
- Add 13-language localized strings in extra.json
…#592)

- Test pure resolution, priority rules, and sanitization
- Test cold-boot hydration and slot constraints
- Test Stop 5.2s transition and teardown deferral on active cards
- Test concurrent multi-session agent tracking
@Ohualtex
Ohualtex force-pushed the feat/issue-592-custom-agents branch from 461b22a to 051f2cd Compare November 25, 2026 18:48

This branch has not been deployed

No deployments
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.

Let third-party agents (coucou_agent) be declared in Active pills so their pill persists

1 participant