worker-discovery-protocol

Protocol for workers to capture and propagate discoveries back to the orchestrator and shared knowledge base. Phase 3 of orchestrator/worker context enforcement (#2020).

5 stars

Best use case

worker-discovery-protocol is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Protocol for workers to capture and propagate discoveries back to the orchestrator and shared knowledge base. Phase 3 of orchestrator/worker context enforcement (#2020).

Teams using worker-discovery-protocol should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/worker-discovery-protocol/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/coordination/worker-discovery-protocol/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/worker-discovery-protocol/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How worker-discovery-protocol Compares

Feature / Agentworker-discovery-protocolStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Protocol for workers to capture and propagate discoveries back to the orchestrator and shared knowledge base. Phase 3 of orchestrator/worker context enforcement (#2020).

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Worker Discovery Protocol

When a worker discovers something important during execution -- a bug, a pattern,
a convention, a tool quirk, a performance insight -- that knowledge must not die
with the worker's session. This skill defines how workers capture discoveries and
how orchestrators propagate them to the shared knowledge base.

## Why This Exists

Workers operate with fresh context and encounter the codebase without assumptions.
This makes them excellent at discovering:
- Undocumented conventions ("this file uses tabs, not spaces")
- Hidden dependencies ("module A silently imports module B at runtime")
- Tool quirks ("pytest requires --no-header flag for clean output here")
- Bug patterns ("this function fails silently when input is empty")
- Performance insights ("this query takes 30s without the index")

Without a capture protocol, these discoveries vanish when the worker session ends.
The next worker (or the same orchestrator in a future session) rediscovers the same
things, wasting time and tokens.

## Worker Responsibilities

### During Execution: Append to Discovery Log

When a worker encounters something noteworthy, it appends to a discovery log file
in the planning directory:

```bash
REPO_ROOT="$(git rev-parse --show-toplevel)"
DISCOVERY_FILE="$REPO_ROOT/.planning/discoveries/$(date +%Y-%m-%d)-worker.jsonl"
mkdir -p "$(dirname "$DISCOVERY_FILE")"

# Append one JSON line per discovery
echo '{"ts":"'"$(date -Iseconds)"'","issue":"#NNN","category":"bug","summary":"function X fails silently on empty input","detail":"src/module.py:42 returns None instead of raising ValueError","severity":"medium","source":"worker-codex-1"}' >> "$DISCOVERY_FILE"
```

### Discovery Categories

| Category | When to log | Example |
|----------|------------|---------|
| `bug` | Found a bug not in the issue scope | Silent failure, race condition, edge case |
| `convention` | Found an undocumented code convention | Naming pattern, import order, config format |
| `dependency` | Found a hidden or undocumented dependency | Runtime import, implicit file requirement |
| `quirk` | Found a tool or environment quirk | Flag requirement, version sensitivity |
| `performance` | Found a performance-relevant insight | Slow query, expensive operation, caching opportunity |
| `security` | Found a security-relevant issue | Exposed credential path, missing validation |
| `pattern` | Found a reusable code or workflow pattern | Helper function, test fixture, config template |

### At Session End: Summary Block

Before the worker session ends, it writes a summary block at the end of its
output or commit message:

```
## Worker Discoveries

- [bug] `src/parser.py:87` — silent failure on malformed input (not in scope, logged)
- [convention] Tests in this module use `@pytest.fixture(autouse=True)` pattern
- [quirk] `uv run` requires `--no-project` flag when running from subdirectory
```

## Orchestrator Responsibilities

### After Worker Returns: Triage Discoveries

The orchestrator reads the worker's discovery log and triages:

| Action | When | How |
|--------|------|-----|
| **Create issue** | Bug or security finding outside current scope | `gh issue create` with discovery details |
| **Update skill** | Convention or pattern that should be codified | Edit relevant SKILL.md or create new one |
| **Update KNOWLEDGE.md** | Quirk or insight that affects future sessions | Append to `.Codex/memory/KNOWLEDGE.md` |
| **Update memory** | Correction to agent behavior or preference | Add to auto-memory via conversation |
| **Discard** | Already known or one-off observation | No action needed |

### Propagation Targets

| Discovery type | Primary target | Secondary target |
|---------------|---------------|-----------------|
| Bug | GitHub issue | None (tracked in issue) |
| Convention | Relevant SKILL.md | `.Codex/rules/` if universal |
| Dependency | Module docstring or README | KNOWLEDGE.md |
| Quirk | KNOWLEDGE.md | `.Codex/memory/topics/` |
| Performance | KNOWLEDGE.md | GitHub issue if actionable |
| Security | GitHub issue (priority:high) | KNOWLEDGE.md |
| Pattern | New or existing SKILL.md | `docs/methodology/` |

### Monthly Consolidation

The nightly comprehensive-learning pipeline (`scripts/cron/comprehensive-learning-nightly.sh`)
processes `.planning/discoveries/*.jsonl` files automatically. Orchestrators do not
need to manually process old discovery logs.

## Integration with Existing Systems

### Comprehensive Learning Pipeline

The discovery JSONL format is compatible with the session signals format used by the
comprehensive-learning pipeline. Discovery files in `.planning/discoveries/` are
picked up during the nightly knowledge harvesting phase.

### Agent Memory Bridge

Cross-agent propagation uses the existing `agent-memory-bridge` skill. When a
discovery applies to all agents (not just the discovering worker's provider):

1. Update `.Codex/memory/KNOWLEDGE.md` (Codex picks this up)
2. Use `agent-memory-bridge` skill to sync to Hermes, Codex, and Gemini

### Extract Learnings to Issues

The `extract-learnings-to-issues` skill can process discovery logs and create
GitHub issues for actionable findings, preventing duplicate issue creation.

## Anti-Patterns

1. **Worker modifies knowledge files directly.** Workers should LOG discoveries,
   not update shared knowledge. The orchestrator triages and routes.

2. **Orchestrator ignores discovery log.** If the orchestrator does not triage,
   discoveries are lost until the nightly pipeline runs (which may not extract
   the same insights an orchestrator would).

3. **Logging everything.** Not every observation is a discovery. Workers should
   log only things that would save time for future workers or prevent future bugs.

4. **Logging without category.** Uncategorized discoveries are harder to triage.
   Always include the category field.

## Quick Reference

### Worker (during execution)
```
1. Encounter something noteworthy
2. Append to .planning/discoveries/YYYY-MM-DD-worker.jsonl
3. Include in session-end summary block
```

### Orchestrator (after worker returns)
```
1. Read .planning/discoveries/*.jsonl from today
2. Triage each discovery: issue / skill / knowledge / memory / discard
3. Execute the routing action
4. Mark discovery as processed (optional — nightly pipeline handles cleanup)
```

## References

- Comprehensive learning: `.Codex/skills/coordination/comprehensive-learning-wrapper/SKILL.md`
- Agent memory bridge: `.Codex/skills/coordination/agent-memory-bridge/SKILL.md`
- Extract learnings: use `/learn-extended` skill
- Orchestrator-worker methodology: `docs/methodology/orchestrator-worker.md`
- Session governance: `docs/governance/SESSION-GOVERNANCE.md`

Related Skills

clinical-trial-protocol

5
from vamseeachanta/workspace-hub

Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.

kanban-worker

5
from vamseeachanta/workspace-hub

Pitfalls, examples, and edge cases for Hermes Kanban workers. The lifecycle itself is auto-injected into every worker's system prompt as KANBAN_GUIDANCE (from agent/prompt_builder.py); this skill is what you load when you want deeper detail on specific scenarios.

Codex-worker-patch-loop

5
from vamseeachanta/workspace-hub

Use Codex as a delegated worker to patch canonical skills or policy files directly, then verify and iterate from the main session.

skill-creator-skill-discovery

5
from vamseeachanta/workspace-hub

Sub-skill of skill-creator: Skill Discovery (+2).

git-sync-manager-1-repository-discovery-from-gitignore

5
from vamseeachanta/workspace-hub

Sub-skill of git-sync-manager: 1. Repository Discovery from .gitignore.

clinical-trial-protocol-what-this-skill-does

5
from vamseeachanta/workspace-hub

Sub-skill of clinical-trial-protocol: What This Skill Does.

clinical-trial-protocol-waypoint-file-formats

5
from vamseeachanta/workspace-hub

Sub-skill of clinical-trial-protocol: Waypoint File Formats (+2).

clinical-trial-protocol-waypoint-based-design

5
from vamseeachanta/workspace-hub

Sub-skill of clinical-trial-protocol: Waypoint-Based Design (+2).

clinical-trial-protocol-study-design-recommendations

5
from vamseeachanta/workspace-hub

Sub-skill of clinical-trial-protocol: Study Design Recommendations.

clinical-trial-protocol-startup-welcome-and-mode-selection

5
from vamseeachanta/workspace-hub

Sub-skill of clinical-trial-protocol: Startup: Welcome and Mode Selection (+1).

clinical-trial-protocol-similar-clinical-trials

5
from vamseeachanta/workspace-hub

Sub-skill of clinical-trial-protocol: Similar Clinical Trials.

clinical-trial-protocol-mcp-server-unavailable

5
from vamseeachanta/workspace-hub

Sub-skill of clinical-trial-protocol: MCP Server Unavailable (+2).