Skip to content

Add closing-the-loop: signal-consuming agent pattern spec#15

Open
jennyf19 wants to merge 2 commits intomainfrom
add-closing-the-loop
Open

Add closing-the-loop: signal-consuming agent pattern spec#15
jennyf19 wants to merge 2 commits intomainfrom
add-closing-the-loop

Conversation

@jennyf19
Copy link
Copy Markdown
Owner

What

Adds closing-the-loop.md to agent-signals/ — the spec for how a dedicated agent reads accumulated signals, detects recurring patterns, and takes action when patterns cross thresholds.

This is the missing piece the README references: 'Close the loop. Signals that are captured but never reviewed are noise.' Now there's a formal protocol for closing it.

What's in the spec

  • Pattern detection algorithm — semantic clustering across 7 dimensions (tsg_gap, skill_gap, what_was_hard, environment_blockers, improvisation, recurring_pattern, what_worked)
  • Volume-scaled thresholds — Low/Medium/High profiles so the loop pace matches signal volume (weekly → daily → hourly)
  • Severity classification — CRITICAL/HIGH/MEDIUM/LOW with clear criteria
  • Action sequences — what happens when a pattern crosses threshold (register → emit partnership signal → take action → report)
  • Known-patterns registry — the consumer's memory, with full lifecycle (detected → acknowledged → in-progress → resolved/wont-fix)
  • Resolution verification — patterns aren't resolved until post-merge signals confirm improvement
  • Partnership signals for the consumer — the observer is observed too
  • Implementation checklist — required/recommended/optional for teams adopting the pattern
  • End-to-end walkthrough — the complete loop from first signal to verified resolution

Also updated

  • README.md — Added closing-the-loop.md to See Also section and linked from step 4
  • CHANGELOG.md — v0.3.0 entry

Design decisions

  • Protocol, not implementation. No code, no platform-specific tooling. Just the contract.
  • Model-agnostic. Works with any LLM running the consuming agent.
  • Thresholds scale with volume. At 500+ signals/week the loop can close in hours, not days.
  • Humans approve, agents propose. The consumer never merges its own PRs.

Defines the protocol for how a dedicated agent reads accumulated
signals, detects recurring patterns via semantic clustering, and
takes action (PRs, issues, reports) when patterns cross thresholds.

Includes:
- Pattern detection algorithm with volume-scaled thresholds
- Severity classification (CRITICAL/HIGH/MEDIUM/LOW)
- Known-patterns registry with full lifecycle
- Partnership signal schema for consumer observability
- Implementation checklist for teams adopting the pattern
- End-to-end loop walkthrough

Also updates README.md See Also section and CHANGELOG.md.

Co-authored-by: Copilot <[email protected]>
Copilot AI review requested due to automatic review settings April 14, 2026 18:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Agent Signals protocol document that specifies how a dedicated “signal-consuming” agent closes the loop by clustering accumulated signals into recurring patterns and triggering human-reviewed remediation actions (PRs/issues/reports). This completes the loop described in agent-signals/README.md by providing a concrete consumer-side contract.

Changes:

  • Added agent-signals/closing-the-loop.md defining pattern detection, thresholds, severity, action sequences, and a known-patterns registry lifecycle.
  • Updated agent-signals/README.md to link to the new “Closing the Loop” spec from the “Close the loop” step and “See Also”.
  • Updated CHANGELOG.md with a 0.3.0 entry documenting the addition and README change.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
agent-signals/closing-the-loop.md Introduces the consumer-agent specification (pattern detection → registry → action → verification), plus signal/registry examples.
agent-signals/README.md Adds references to the new spec where the loop is described and in “See Also”.
CHANGELOG.md Records the new spec and README linkage under v0.3.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agent-signals/closing-the-loop.md Outdated
Comment on lines +136 to +138
| Severity | Criteria |
|----------|----------|
| **CRITICAL** | Confidence ≤ 3 in 5+ signals for the same skill within the time window, OR escalation rate > 50% for any skill |
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

Severity criteria references "escalation rate > 50%" but the term "escalation rate" isn't defined (e.g., rate of escalation signals per run? per skill? per window?). Please define the metric precisely so different implementations classify severity consistently.

Suggested change
| Severity | Criteria |
|----------|----------|
| **CRITICAL** | Confidence ≤ 3 in 5+ signals for the same skill within the time window, OR escalation rate > 50% for any skill |
For severity classification, **escalation rate** is defined **per skill, within
the current evaluation time window** as:
`escalation rate = (# of signals for that skill in the window with escalation = true) / (total # of signals for that skill in the window)`
In this table, **escalation rate > 50%** means **strictly more than half**
of all signals for a single skill in the current time window explicitly
request escalation.
| Severity | Criteria |
|----------|----------|
| **CRITICAL** | Confidence ≤ 3 in 5+ signals for the same skill within the time window, OR escalation rate for a skill in the current time window is > 50% |

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +41
### 1.1 Primary Input: Pattern Dimensions

The consuming agent reads the pattern dimensions from execution
signals (see [SIGNAL.md](SIGNAL.md)):

| Dimension | What It Tells the Consumer |
|-----------|---------------------------|
| `what_was_hard` | Friction points — where agents struggle |
| `skill_gap` | Missing capabilities agents wish they had |
| `tsg_gap` | Missing or inadequate guidance in documentation |
| `recurring_pattern` | Patterns the producing agent has seen before |
| `improvisation` | Novel approaches not covered by existing skills |
| `environment_blockers` | External issues (APIs, permissions, infra) |
| `what_worked` | Effective techniques worth preserving |
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The spec lists environment_blockers as a pattern dimension, but agent-signals/SIGNAL.md's normative execution.patterns contract does not include this field. As written, a consumer following this spec won't be able to reliably parse signals that conform to the schema. Either add environment_blockers to the SIGNAL.md schema (and examples) or remove/mark it as an extension field here.

Copilot uses AI. Check for mistakes.
Comment on lines +84 to +90
```
For each pattern dimension d in [tsg_gap, skill_gap, what_was_hard,
environment_blockers, improvisation, recurring_pattern]:

1. COLLECT all non-empty values of d from signals in the time window
2. CLUSTER by semantic similarity (LLM-assisted grouping)
3. COUNT occurrences per cluster, grouped by skill
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

This document says pattern detection covers "all seven dimensions" (§2.1 / checklist), but the detection algorithm (§2.2) iterates over only 6 dimensions and omits what_worked (and the thresholds table also doesn't define a threshold for it). Please reconcile: either include what_worked in the algorithm/thresholds, or explicitly state it is excluded from threshold-based detection and how it should be handled.

Copilot uses AI. Check for mistakes.
Comment thread agent-signals/closing-the-loop.md Outdated
],

"action_taken": "pr_opened",
"action_ref": "https://github.com/org/repo/pull/123",
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The partnership signal JSON example includes action_ref as a GitHub PR URL. agent-signals/SIGNAL.md's Privacy section says signals must never contain repository URLs; even in examples this conflicts with the protocol's stated constraints. Consider using a non-URL opaque identifier (e.g., pr_id/issue_id) or a clearly anonymized placeholder that isn't a repository URL.

Suggested change
"action_ref": "https://github.com/org/repo/pull/123",
"action_ref": "pr-123",

Copilot uses AI. Check for mistakes.
Comment thread agent-signals/closing-the-loop.md Outdated
"pattern": "Multi-module rollback documentation missing",
"dimension": "tsg_gap",
"frequency": 4,
"severity": "medium",
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

Severity is defined earlier as CRITICAL/HIGH/MEDIUM/LOW (uppercase) and the registry schema uses uppercase, but this example uses lowercase "medium". Please standardize the severity enum casing across the doc and examples to avoid downstream parsing/validation mismatches.

Suggested change
"severity": "medium",
"severity": "MEDIUM",

Copilot uses AI. Check for mistakes.
Comment on lines +301 to +305
dimension: tsg_gap
pattern_summary: "Multi-module rollback docs missing from remediation skill"
status: detected | acknowledged | in-progress | resolved | wont-fix
severity: CRITICAL | HIGH | MEDIUM | LOW
evidence:
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

In this YAML "schema" example, status: detected | acknowledged | ... and severity: CRITICAL | HIGH | ... look like literal scalar values rather than an enumeration. To avoid readers copying an invalid/ambiguous representation, consider formatting this as status: detected # one of: ... (same for severity) or listing allowed values separately.

Copilot uses AI. Check for mistakes.
- Define 'escalation rate' precisely (per skill, per window)
- Mark environment_blockers as extension dimension (not in base SIGNAL.md schema)
- Clarify what_worked is excluded from threshold detection (positive signal)
- Fix severity casing: 'medium' → 'MEDIUM' for consistency
- Replace repository URLs with opaque identifiers per SIGNAL.md privacy rules
- Fix YAML enum formatting to avoid ambiguous pipe-separated values
- Update checklist to reference correct section numbers

Co-authored-by: Copilot <[email protected]>
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.

2 participants