Agent harness: rig-based loop, layered prompt system, and failure-driven prompt improvement
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- rust
调研方向
Start by reading the proposed build order, especially assemble_brief and syscribe brief, then inspect the existing MCP server tools and example models. The issue proposes a new syscribe-harness crate and several open design decisions, so first scope a single build-order step and identify its existing entry points and tests. Done criteria should come from an ADR, requirements, and PlanningItem tree, which the issue says still need to be created.
由索引模型根据 Issue 内容生成。
描述
Summary
Syscribe already provides the state and governance layer of an agent harness: a PlanningItem work queue, claim/release, an MCP server with guarded writes, [agents] policy (protected_paths, actors), human-owned questions (answerBy: human), an audit trail, and "done" gates (validate, trace-code, E719, W310). What is missing is the agent loop and the prompt system around it.
Proposal: a new syscribe-harness crate in which a rig agent is an MCP client of the existing server, so every guarded-write check still applies, plus a layered prompt system that learns from its own failures.
Goals
- A loop that takes a
PI-*, claims it, assembles context, runs a rig agent, runs the gates, and either marks the item done with evidence or records a question and releases the claim. - A layered prompt system whose task context is generated from the model, not hand-written.
- A feedback loop that turns gate failures into reviewed, evaluated prompt improvements.
Design
Integration shape
- A (recommended first): rig as an MCP client of
syscribe mcp. Reuses guarded writes, dry-run/delta/commit,--expect-hash, protected paths. - B (later, if profiling justifies): depend on
syscribe-modeland register native rigTools. Faster, but easy to bypass the guarded-write path.
Prompt layers (stable to volatile, so the prefix caches)
| # | Layer | Source |
|---|---|---|
| 1 | Role and rules | new prompts/harness/role.md, distilled from the CLAUDE.md "Safe mutation" rules |
| 2 | Format guide | core of create-model.md plus on-demand spec <topic> / help <Type> lookup |
| 3 | Project overlay | existing agent_instructions_section hooks (link types, binding time), [agents], [users] |
| 4 | Task brief for one PI-* |
new assemble_brief(model, pi); syscribe brief <PI> [--json] [--budget N] |
| 5 | Gate contract | generated from the real gate commands |
Templates live as files in prompts/harness/*.md with a slot delimiter that does not collide with {{X.y}} value references. A [harness] table in .syscribe.toml may override a layer.
The brief contains: the goal and parent/child state (steps), full text of every achieves: requirement with ancestors and breakdownAdr, satisfiedBy elements and implementedBy paths, existing TestCases and verdicts, answered/open questions and blockedBy, and hazards (W311 overlaps, suspect links, protected paths). Each section has a token budget; anything cut is listed as an id pointer.
Learning from failures
- Run record sidecar per run: prompt layer hashes, model id, PI id, brief hash, outcome (
done | gate-failed | escalated | retry-exhausted | abandoned), gate findings per attempt, rejected writes, tool errors, cost. harness failures: deterministic aggregation by finding code and prompt layer, with a cause classification (instruction missing, ignored, brief missing context, unhelpful tool error, model limit).harness analyze: LLM-proposed diff to one layer, emitted as a PlanningItem with a falsifiable claim. Never a direct edit.- Replay set and runner: baseline vs candidate, N runs each, gate-pass rate / retries / escalations / cost. One layer changed per proposal. Rules that never fire are pruning candidates.
- Human gate: approval through an
answerBy: humanquestion.
Tool calls the rig agent needs
Most exist in the MCP server today (names from tool_names()); gaps are marked.
Orient and read
| Tool | Purpose | Status |
|---|---|---|
get_element |
fetch an element (detail, fields projection, docRendered) |
exists |
steps, questions |
PI breakdown, open questions | exists |
trace, impact, follow, neighbors |
traceability context | exists |
search, search_text, list_by_type, children |
locate elements | exists |
describe_type, explain_finding, template |
learn the format on demand | exists |
get_brief |
the assembled task brief | new |
Write (guarded)
| Tool | Purpose | Status |
|---|---|---|
next_id |
never invent an id | exists |
create_element, update_element, move_element, delete_element |
model edits | exists |
evidence |
attach evidence to a PI | exists |
question |
record a decision instead of guessing | exists |
claim_item, release_item |
ownership; claim/release are CLI-only today |
new (verify) |
amend |
amendment.add on an accepted ADR / approved requirement |
verify via update_element |
Verify and gate
| Tool | Purpose | Status |
|---|---|---|
validate, validate_element |
model checks | exists |
trace_code |
untraced code units | exists |
gates |
the "before declaring done" set | exists, check it covers W310/E719 |
ingest_results |
feed test results back as evidence | exists |
requirement_coverage |
verdict per requirement | exists |
Code side (not in the MCP server)
| Tool | Purpose | Status |
|---|---|---|
read_file, edit_file |
source edits, honouring protected_paths |
new |
run_command |
cargo test, cargo build, allow-listed |
new |
finish |
the agent signals completion, which triggers the gate run | new, harness-local |
escalate |
raise an answerBy: human question and stop |
new, harness-local (wraps question) |
finish and escalate are handled by the harness loop itself rather than the model server, so the harness, not the agent, decides when the work is done.
Build order
assemble_briefplussyscribe brief, with golden tests on the example models.- Embedded layer templates and
harness prompt <PI>(print the assembled prompt). - Trim
create-model.mdto a core plus on-demand lookup, measured first. - rig loop: claim, brief, agent, gates, retry (capped), escalate, release.
- Run-record sidecar and
harness failures. - Replay runner.
harness analyze, last.
Open decisions
- Big cached format-guide prefix, or on-demand lookup? (lean: on-demand, then measure)
- Slot delimiter for templates (must not collide with
{{X.y}}) - Do prompt files carry
amendments:records? - Retry cap and which PIs an agent may take (exclude
answerBy: humanblockers) - Where run records live and whether transcripts are stored (privacy)
Process (per repo convention)
- ADR covering layering,
brief, rig-over-MCP, and prompt evolution -
REQ-TRS-HARNESS-*requirements - Native
PlanningItemtree undermodel/Planning/ - Design element whose
implementedBy:names the new crate (avoidsW326) - Discoverability checklist: template, help, search, tasks, explain, agent-guide, docs
- 主要语言
- Rust
- 星标
- 8
- 派生
- 1
- 平均合并
- 4 小时 44 分钟
- 30 天内合并 PR
- 51
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sjames/syscribe 的其他 Issue
-
enhancement
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
-
Format-preserving writes for structural frontmatter (features, connections, layout, shapes, edges)未关闭
难度 5/5 一周以上 新手友好度 25/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
相似的 Issue
-
build P3
难度 2/5 1-3 小时 新手友好度 82/100
maniator/verticopolis#1945 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
bug priority: medium
难度 2/5 1-3 小时 新手友好度 76/100
storytold/gridcraft#3785 · 1 条评论 ·
维护者通常 1 天内回复
-
bug bugfix priority: medium ui
难度 2/5 1-3 小时 新手友好度 76/100
storytold/deckcraft#2037 · 1 条评论 ·
维护者通常 1 天内回复
-
[Linux] Generated .desktop files quote Exec path, so xdg-open/xdg-mime ignore the app as default未关闭bug file-compat install linux priority: medium
难度 2/5 1-3 小时 新手友好度 77/100
storytold/craft-launcher#1393 ·
维护者通常 1 天内回复