Skip to content

feat(loop-context): add tool + release wiring#129

Merged
cobusgreyling merged 1 commit into
mainfrom
feat/loop-context-release-wiring-clean
Jul 2, 2026
Merged

feat(loop-context): add tool + release wiring#129
cobusgreyling merged 1 commit into
mainfrom
feat/loop-context-release-wiring-clean

Conversation

@cobusgreyling

Copy link
Copy Markdown
Owner

Summary

Implements Option B from PR #125 review: lands @KhaiTrang1995's loop-context tool with maintainer release/docs scaffolding.

Changes

  • tools/loop-context — CLI, library API, 18 tests
  • release-loop-context.yml (loop-context-v* tags)
  • Root README.md + docs/RELEASE.md
  • Ledger population example + exports in package.json
  • CI gates in package.json + ci-validate-gates.sh

Credit: implementation from PR #125 (@KhaiTrang1995). This PR supersedes direct merge of #125.

After merge: configure npm trusted publisher for release-loop-context.yml, then git tag loop-context-v1.0.0 && git push origin loop-context-v1.0.0

Merges @KhaiTrang1995 implementation with maintainer release scaffolding:
- tools/loop-context (CLI, library, 18 tests)
- release-loop-context.yml (loop-context-v* tags)
- README.md + docs/RELEASE.md entries
- Ledger population example in tool README
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Loop Readiness Audit

Score: 100/100 (L3)

Strong loop readiness — good candidate for L3 with explicit gates.

Top suggestions

  • Create loop-constraints.md with denylist paths, push/merge rules, and human gates (see templates/loop-constraints.md)

Posted by audit.yml · loop-audit docs

@cobusgreyling cobusgreyling merged commit 1481190 into main Jul 2, 2026
2 checks passed
@KhaiTrang1995

Copy link
Copy Markdown
Contributor

Thank you for the detailed review and for handling the release wiring — much appreciated! Option B is perfect for me. If possible, would you mind keeping a Co-authored-by: trailer on the commits so the work shows in the history? Either way, thanks a lot for the thoughtful feedback

cobusgreyling pushed a commit that referenced this pull request Jul 4, 2026
… ci-sweeper (#140)

* feat(mcp-server): add MCP server for runtime resource lookup

MCP server exposes loop-engineering patterns, skills, state, budget,
and safety docs as queryable resources via Model Context Protocol.
Agents can query what they need on-demand instead of prompt stuffing.

Resources: registry, config, budget, run-log, safety, patterns/{id},
skills/{name}, state/{file}

Tools: list_patterns, list_skills, list_state_files, get_pattern,
get_skill, get_state, recommend_pattern, estimate_cost

Includes 16 tests, CI gate integration, and MCP config example.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix(mcp-server): declare zod as direct dependency + add server integration tests

zod was imported in src/index.ts but only resolved transitively via
@modelcontextprotocol/sdk, so the build could break if the SDK changed
its zod range. Declare it explicitly in dependencies.

Add 4 integration tests that spawn the real server over stdio and exercise
the index.ts tool/resource handlers (tools/list, loop_list_patterns,
loop_estimate_cost, pattern resource read), complementing the existing
resolver-level unit tests. Suite now 20/20 passing.

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

* feat(loop-context): stateful memory manager with pruner + circuit breaker

Adds tools/loop-context — a deterministic, dependency-free manager that sits
between an agent loop and its durable memory to prevent the two classic
long-run failures: context overflow/rot and stagnant/no-progress loops.

Before each iteration it can:
- summarize what has been tried (factual rollup, no LLM needed),
- prune verbose stack traces, collapse repeated errors, and keep only a
  recent window of attempts,
- inject a compact context block into the next prompt.

The circuit breaker escalates to a human on stagnation (same error N× in a
row), no-progress (N consecutive failures), token budget, or iteration cap —
instead of burning tokens in a hopeless loop. Errors are normalized to a
stable signature so "the same error" is recognized across volatile details
(line numbers, ports, addresses, temp paths).

Ships a CLI (--check/--prune/--inject/--summary/--status, stdin or --ledger)
with escalate=exit 2, a library API, 18 tests, and CI gate + build wiring.

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

* feat(loop-init): scaffold loop-context circuit breaker for fix patterns

loop-context (the stateful memory manager / circuit breaker) shipped in
#129, but nothing wired it into a real loop yet. This makes the breaker
part of the scaffold so new projects get it by default.

- New loop-guard skill template: log each attempt to loop-ledger.json and
  run `loop-context --check` before retrying; on exit 2, inject a pruned
  summary and escalate instead of looping.
- loop-init now scaffolds the loop-guard skill + a goal-seeded
  loop-ledger.json for fix-capable patterns (pr-babysitter, ci-sweeper,
  dependency-sweeper, post-merge-cleanup). Report-only patterns skip it.
- Wire the breaker into the ci-sweeper pattern doc and the loop-constraints
  template, turning the soft "max 3 attempts" rule into a mechanical gate.
- Tests: guard + ledger scaffolded for fix patterns (grok and opencode
  paths) and NOT for report-only daily-triage.

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

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
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