Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function Outcome({goalId, outcome, fresh, canManage, revision, onRefresh, zh, sh
if (busy || !fresh || !canManage || !revision || !text.trim()) return;
const identity = crypto.randomUUID();
const request = pending ?? {action: "refine", expected_provider_revision: revision, operation_id: `outcome-ui:${identity}`,
refinement: {outcome_id: outcome.id,
refinement: {outcome_id: outcome.id, storage_format: "records",
requirements: [{id: `requirement-${identity}`, description: text.trim()}],
source: {ref: `owner:${identity}`, summary: text.trim()}}};
setPending(request); setBusy(true); setNotice("");
Expand Down
20 changes: 20 additions & 0 deletions docs/architecture/rfcs/goal-outcome-refinement-v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -614,3 +614,23 @@ SQLite/HTTP/CLI authority and injects transport failures, not fabricated commits
These checks establish product semantics and recovery. Live-model recognition,
installed host adoption and comparative quality/attention gains remain unproven
until separately measured; test counts and a merged PR are not those outcomes.

### Record-format capacity recovery

The opt-in `storage_format: "records"` refinement now selects
`loopx_goal_outcome_records_v1` with the same Goal lifetime, ordered declarations,
origins, work, reviews and CAS/receipt owner. Legacy v0 limits remain unchanged.
Record pages and new operations have independent 128 KiB budgets; retained
collection length no longer consumes the per-operation budget. Inventory digests
reject missing/altered pages. `review_patch` retains per-item basis freshness;
complete `review` remains complete. App additions and native/CLI operations use
the same owner. See the [operational contract](../../reference/goal-acceptance-observations.md#long-horizon-record-storage).

This is capacity recovery and an additive evolution path, not completion of
record-indexed persistence, scoped concurrency, objective/condition replacement,
peer adoption, model benefit or installed qualification. Physical pages remain
inside the full provider snapshot; complete readback/transport costs still grow.
The existing objective proposal/apply/adopt owner is unchanged. Migration occurs
only with the explicit committed refinement; old receipts are never rewritten.
New record-format receipts recover the current projection without embedding a
full duplicate declaration. A compatible runtime is required after cutover.
16 changes: 16 additions & 0 deletions docs/architecture/rfcs/goal-outcome-refinement-v0.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -448,3 +448,19 @@ Goal 生命周期变化会重置编辑器,不能把旧请求转移给新 owner

这些验证证明产品语义和恢复,不证明真实模型识别、安装宿主采用、质量增益或
人工注意力下降;测试数量与 PR 合并均不能替代后者。

### 记录格式的容量恢复

refinement 显式携带 `storage_format: "records"` 时,以原 Goal 生命周期、
有序声明、来源、工作、自查和 CAS/回执 owner 选择
`loopx_goal_outcome_records_v1`。旧 v0 限制保持。记录页和新操作分别受
128 KiB 预算约束,长期保留的集合长度不再占单次写入预算;有序清单摘要拒绝
缺失或被修改的页。`review_patch` 保留逐项依据新鲜度,完整 `review` 仍要求
全量覆盖。App 补充要求和原生/CLI 操作复用同一 owner。见
[操作合同](../../reference/goal-acceptance-observations.md#long-horizon-record-storage)。

这是容量恢复和追加演化路径,不表示索引式存储、局部并发、目标/条件替换、
跨 Agent 采用、模型收益或已安装资格完成。物理分页仍位于完整 provider 快照
内部,整份读回和传输成本仍增长;已有 objective proposal/apply/adopt owner
保持不变。只在显式 refinement 提交时迁移,不重写旧回执。新格式回执恢复当前
投影而不复制完整声明;切换后必须使用兼容运行时。
67 changes: 67 additions & 0 deletions docs/reference/goal-acceptance-observations.md
Original file line number Diff line number Diff line change
Expand Up @@ -994,3 +994,70 @@ model preparation or a complete one-round request.
| --- | --- | --- |
| Desktop | ![Earlier desktop](../../examples/personal-workspace-browser/check-overview-before-desktop.png) | ![Check in the Goal brief](../../examples/personal-workspace-browser/check-overview-desktop.png) |
| 390px | ![Earlier phone](../../examples/personal-workspace-browser/check-overview-before-phone.png) | ![Phone check and folded details](../../examples/personal-workspace-browser/check-overview-phone.png) |

## Long-horizon record storage

An authorized correction can now outlive the legacy declaration's 128 KiB,
32-requirement, 24-outcome and 64-origin collection limits. Keep the original
Goal and outcome. In `goal-acceptance refine`, add `"storage_format":"records"`
to the usual refinement document, preview it without `--execute`, then execute
with the same inspected provider revision and operation id. The first committed
refinement losslessly selects `loopx_goal_outcome_records_v1` in the existing
atomic authority transaction. Reads, previews and installation do not migrate.
App **Supporting outcomes → Add a requirement** selects that format with the
requested addition. Native `refine_outcome` accepts the same field; Lark's native
conversation uses that tool owner, with no separate acceptance configuration.

```json
{
"outcome_id": "release-readiness",
"storage_format": "records",
"requirements": [{"id": "restart", "description": "Recovery preserves the original work identity."}],
"source": {"ref": "owner:recovery", "summary": "Authorized recovery requirement"}
}
```

For native conversations, use `source_summary` instead of `source`; the host
retains its source/actor identity. Prepare a **new** operation id when changing
intent after a confirmed rejection. Recover an ambiguous operation unchanged
before preparing a different request. Restart and exact retries preserve the
original outcome, requirements, sources, work links and exactly-once operation.
Unsupported old readers must be upgraded; after a record-format commit, use a
compatible runtime for rollback, never restore an old backup over new requirements.

The format separates retained records from the mutation budget: each operation
and collection page remains at most 128 KiB UTF-8; a page has at most 32 records.
Individual text/evidence bounds remain unchanged. Additions still contain at most
32 requirements at a time. Each outcome's ordered collection digest detects
missing or altered pages. These pages remain **inside the existing authority
snapshot**: this release does not provide an indexed store, constant-cost reads,
record-level concurrency, unlimited transport or less model context. Existing
capture/field selectors provide bounded detail from one complete capture; do
not silently truncate a full acceptance read. Full snapshot and transport costs
still grow and retain their existing limits.

For large outcomes, `review_patch` contains up to 32 named requirement reviews
with the existing `{id, conclusion, evidence_refs, note}` shape. It changes only
those reviews. Each item retains its own reviewed basis; reviewing one item
cannot refresh older evidence for another. `review` retains its complete-review
meaning. Independent configured checks remain authoritative, and an Agent's
self-assessment never becomes an independent acceptance result.

A correction to success conditions uses this refinement path; a change of the
shared purpose still uses the existing objective proposal/apply/adopt path.
Replacement/withdrawal and atomic objective-plus-condition amendments are not
introduced by a storage migration. Other Agents retain their work ownership,
leases, permissions and their own objective adoption obligations. Subsequent
context and replan read the same preserved requirements; Vision remains the
execution response, not an alternative acceptance ledger.

中文:已有 Goal 满额后,沿用原成果,在 refinement 文档中加入
`storage_format: "records"`,以同一 revision/operation 预演、提交。App 的
“补充要求”随这次明确的写入选择新格式;读取、安装和预演不迁移。
新格式把长期记录与单次写入/分页预算分开,保留每条原始要求、来源、身份和
顺序。分页仍存在原 authority 快照中,并非独立索引存储;整份快照的读写和
传输成本仍随内容增长。大成果可用 `review_patch` 分批自查,每条证据保留自己的
依据,不能借复审另一条刷新旧证据。修改整体目标继续走已有 proposal/apply/adopt,
本次不授予替换、撤销、跨 Agent 采用或完成验收的权限。已确认拒绝后改变意图需新
operation;结果不明时先恢复原操作。旧运行时不能读写新格式,回滚须使用兼容版本,
不能用旧备份覆盖新要求。
8 changes: 4 additions & 4 deletions loopx/chat_loopx_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"The host supplies the Goal and preparing Agent. It saves only a reviewable goal.acceptance.check proposal; it does not configure acceptance or run commands. "
"The local owner can use that plan beside the delivery in the workspace. "
"Action=outcomes reads persistent supporting outcomes and the provider revision. "
"Action=refine_outcome takes operation_id, expected_provider_revision and document with outcome_id; add only changed requirements [{id,description}], todo_ids or review. Creation also needs the original objective. source_summary is required for creation/new requirements; omit it for existing-outcome reviews/work links and put milestone evidence in review.evidence_refs to retain declaration origins. "
"Action=refine_outcome takes operation_id, expected_provider_revision and document with outcome_id; add only changed requirements [{id,description}], todo_ids or review. Creation also needs the original objective. storage_format=records explicitly retains the existing declaration in paged record storage when cumulative capacity is reached; keep the same outcome and all origins. review_patch reviews up to 32 named requirements without refreshing the others. source_summary is required for creation/new requirements; omit it for existing-outcome reviews/work links and put milestone evidence in review.evidence_refs to retain declaration origins. "
"Action=prepare_goal_objective takes operation_id and document {objective,reason}; it prepares an owner-reviewed shared objective revision without changing root commitments. Action=adopt_goal_objective takes operation_id, expected_provider_revision and document {revision,digest,work_digest,review_summary} after reconciling your work; action=outcomes returns its basis. "
"Optional review addresses every retained requirement with {id,conclusion: met|unmet|uncertain,evidence_refs: strings,note}. "
"The host fixes the owner and retains the first source Turn for an unchanged operation in this conversation. After response loss, retry the same operation, revision and document. "
Expand All @@ -69,7 +69,7 @@
"expected_provider_revision": {"type": "string"},
"document": {
"type": "object",
"description": "For refine_outcome: outcome_id, plus changed requirements [{id,description}], todo_ids (existing work) or review; original objective required on creation. source_summary is required only for creation/new requirements; omit for review/work maintenance, with new evidence in review.evidence_refs. No actor/source routing. For prepare_check, prefer {outcome_id, criteria: [{id: existing requirement ID, validation_argv: string array, optional validation_timeout_seconds}]}; the owner resolves retained descriptions and linked work. Legacy standalone check document: objective (string), non_goals (strings), scope ({kind: selected_work, todo_ids: existing advancement Todo ids} or {kind: all_advancement}), criteria (id, description, validation_argv string array, optional validation_timeout_seconds), bindings (todo_id, criterion_ids). Checks use the registered Goal workspace or its pinned oracle snapshot only after local-owner apply. Use known requirements and approved scope; do not invent an oracle or authorization.",
"description": "For refine_outcome: outcome_id, plus changed requirements [{id,description}], todo_ids (existing work) or review; original objective required on creation. source_summary is required only for creation/new requirements; omit for review/work maintenance, with new evidence in review.evidence_refs. For a full retained declaration, set storage_format to records in the refinement; use review_patch for changed requirement reviews. Preserve original operation identity on ambiguous writes; changed intent after a confirmed rejection needs a new operation id. No actor/source routing. For prepare_check, prefer {outcome_id, criteria: [{id: existing requirement ID, validation_argv: string array, optional validation_timeout_seconds}]}; the owner resolves retained descriptions and linked work. Legacy standalone check document: objective (string), non_goals (strings), scope ({kind: selected_work, todo_ids: existing advancement Todo ids} or {kind: all_advancement}), criteria (id, description, validation_argv string array, optional validation_timeout_seconds), bindings (todo_id, criterion_ids). Checks use the registered Goal workspace or its pinned oracle snapshot only after local-owner apply. Use known requirements and approved scope; do not invent an oracle or authorization.",
},
"limit": {"type": "integer", "minimum": 1, "maximum": 50},
"cursor": {"type": "string"},
Expand Down Expand Up @@ -936,7 +936,7 @@ def dispatch(name, arguments):
if set(arguments) != {"action", "operation_id", "expected_provider_revision", "document"}:
raise ValueError("refine_outcome needs its stable operation, inspected revision and document")
document = arguments["document"]
if not isinstance(document, dict) or "outcome_id" not in document or set(document) - {"outcome_id", "objective", "requirements", "todo_ids", "source_summary", "review"}:
if not isinstance(document, dict) or "outcome_id" not in document or set(document) - {"outcome_id", "objective", "requirements", "todo_ids", "source_summary", "review", "review_patch", "storage_format"}:
raise ValueError("refine_outcome document cannot replace host identity or source")
if not isinstance(operation_id, str) or not operation_id.strip():
raise ValueError("refine_outcome requires a stable operation id")
Expand All @@ -951,7 +951,7 @@ def dispatch(name, arguments):
"document": document,
},
)
refinement = {key: document[key] for key in ("outcome_id", "objective", "requirements", "todo_ids") if key in document}
refinement = {key: document[key] for key in ("outcome_id", "objective", "requirements", "todo_ids", "review_patch", "storage_format") if key in document}
if "review" in document:
refinement["review"] = document["review"]
refinement["owner_agent_id"] = settings["agent_id"]
Expand Down
11 changes: 11 additions & 0 deletions loopx/cli_commands/goal_acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ def register_goal_acceptance_command(subparsers: Any, add_format: Any) -> None:
owner input nor adoption; only an applied objective revision needs adoption.
Authority, budgets, stops and existing gated actions remain binding.

Long-horizon requirements (refine):
Keep the same outcome_id. Add "storage_format":"records" to the document to
preview/commit lossless record storage with the next authorized refinement.
Retained requirements/origins no longer consume the per-operation/page budget.
Use "review_patch":[{id,conclusion,note,evidence_refs}] for up to 32 named
requirements; unreviewed or stale evidence stays unchanged. "review" still
means a complete review. No new permission or independent check is granted.
After a known rejection, inspect and prepare a new operation id; after an
ambiguous result, recover the original operation before changing intent.
See docs/reference/goal-acceptance-observations.md#long-horizon-record-storage

Owner check-scope reconciliation (configure without --agent-id):
--document is the full replacement: {"scope":{"kind":"selected_work","todo_ids":["todo_current"]},
"objective":"Retained objective","non_goals":[],"criteria":[{"id":"result","description":"Real check", "validation_argv":["python3","check.py"]}],
Expand Down
2 changes: 1 addition & 1 deletion loopx/cli_commands/project_lifecycle_refresh_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ def handle_refresh_state_command(
agent_id=args.agent_id, execute=not args.dry_run, **outcome_update,
**({"reviewed_work_update": {"todo_id": args.todo_id,
"append_explore_result_node_refs": [explore_result["node_id"]]}}
if explore_result is not None and "review" in outcome_update["refinement"] else {}))
if explore_result is not None and any(key in outcome_update["refinement"] for key in ("review", "review_patch")) else {}))
outcome_update_result = public_goal_acceptance(refinement_result, include_contract=False)
if args.dry_run:
# Preview the same ordered composition as execution: the typed
Expand Down
Loading
Loading