feat(loop-context): add tool + release wiring#129
Merged
Conversation
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
Contributor
Loop Readiness AuditScore: 100/100 (L3) Strong loop readiness — good candidate for L3 with explicit gates. Top suggestions
Posted by |
12 tasks
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Option B from PR #125 review: lands @KhaiTrang1995's
loop-contexttool with maintainer release/docs scaffolding.Changes
tools/loop-context— CLI, library API, 18 testsrelease-loop-context.yml(loop-context-v*tags)README.md+docs/RELEASE.mdexportsin package.jsonpackage.json+ci-validate-gates.shCredit: implementation from PR #125 (@KhaiTrang1995). This PR supersedes direct merge of #125.
After merge: configure npm trusted publisher for
release-loop-context.yml, thengit tag loop-context-v1.0.0 && git push origin loop-context-v1.0.0