Skip to content
Closed
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
6 changes: 0 additions & 6 deletions docs/architecture/rfcs/goal-outcome-refinement-v0.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
# RFC: Persistent Goal outcome refinement (v0)

> Implementation checkpoint: this dependent slice ships cumulative declarations,
> scoped ownership, retry/recovery, caller readback and referenced check plans.
> The automatic frontier/ACK and same-snapshot status/refresh oracle path below
> remains the next dependent slice. Historical combined-proposal evidence is
> retained here; current validation is reported on each exact PR head.

- Status: Implementation proposed; installed/model adoption and comparative benefit remain unqualified.
- Owner: Core Goal acceptance and work planning (S3/R4), with S1/S5 callers.
- Language mirror: [中文](goal-outcome-refinement-v0.zh-CN.md).
Expand Down
4 changes: 0 additions & 4 deletions docs/architecture/rfcs/goal-outcome-refinement-v0.zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# RFC:持久化 Goal 成果细化(v0)

> 实现检查点:本切片交付累计声明、作用域归属、重试恢复、调用方读回和引用要求的检查方案。
> 下文的自动 frontier/ACK、status/refresh 同快照 oracle 路径由下一依赖切片交付。
> 原组合提案的历史证据保留;每个 PR 单独记录当前提交的验证结果。

- 状态:实现提案;安装/模型采用与比较收益尚未取得资格。
- 归属:Core Goal 验收与工作规划(S3/R4),调用方为 S1/S5。
- 英文镜像:[English](goal-outcome-refinement-v0.md)。
Expand Down
1 change: 1 addition & 0 deletions docs/architecture/rfcs/loopx-overall-roadmap-v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,7 @@ original-route completion. Those remain the same R3 acceptance gates above.
### R4: Shared Goal Alignment and Evolution

- **Work versus obligations:** follow [alignment RFC §3.7](shared-goal-alignment-and-governed-amendment-v0.md#37-current-work-and-goal-requirements). Keep stable criterion identity and coverage across replan, compaction, restart and Agent handoff; allow only authorized, recorded amendments to change the commitment. Reuse the existing Goal acceptance and Todo owners through R5. Validate evidence content, scope and freshness before global closeout; a local `no_followup` is insufficient. This remains open beyond the shared Goal/current-work read prerequisite; S11 owns qualification of actual model adoption.
- **Outcome continuity slice:** [default refinement and review](goal-outcome-refinement-v0.md) retains original intent and cumulative requirements, reuses inline work context and batches changed evidence into normal writeback. Existing replan receives uncovered requirements; local reviews never change root stop/budget authority. Additive File/SQLite and packaged UI qualification is separate from S11 model adoption and matched EdgeBench benefit; no experiment is launched here.
- **Owner:** alignment RFC Stage 3–5 and TS Goal/work-graph owners.
- **First correction:** `intent_basis` remains the existing source-facts digest. Preserve compatible readers; introducing a real intent revision requires versioning and producer/reader inventory. Renaming cannot give historical receipts stronger semantics.
- **Order:** establish root intent/permissions/acceptance/stop authority, then one intent-preserving work-graph commit class. Ordinary Todo edits retain existing owners; do not require amendment for every add. Changes to shared commitments consume scoped policy, required verifier, exact CAS and lease-impact disposition.
Expand Down
1 change: 1 addition & 0 deletions docs/architecture/rfcs/loopx-overall-roadmap-v0.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ Lark 传输 owner,本切片不再重复修改它。
### R4:共享目标对齐与演化

- **当前工作与完整义务:** 遵循 [alignment RFC §3.7](shared-goal-alignment-and-governed-amendment-v0.zh-CN.md#37-当前工作与-goal-要求)。跨重规划、压缩、重启和 Agent 交接保留 criterion 身份与覆盖关系;只有授权且留痕的 amendment 可改变承诺。经 R5 复用既有 Goal acceptance 与 Todo owner。全局收口前验证证据内容、范围和时效,局部 `no_followup` 不足以结清目标。共享 Goal/当前任务读取前置之外的部分仍未完成;模型实际采用的资格归 S11。
- **成果连续性切片:** [默认细化与自查](goal-outcome-refinement-v0.zh-CN.md) 保留原始意图和累计要求,复用内联工作上下文,把有变化的证据合并进正常写回。未覆盖要求进入现有 replan,局部自查不改变根目标停止/预算权威。只增式 File/SQLite 与打包 UI 验证,同 S11 模型采用及匹配 EdgeBench 收益分开记录;这里不发起实验。
- **Owner:** alignment RFC Stage 3–5;TS Goal/work-graph owner。
- **先收口:** `intent_basis` 仅是现有 source-facts digest;保留兼容 reader,真正引入 intent revision 时单独版本化并盘点 producer/reader。不得改名后假装历史回执拥有新语义。
- **交付次序:** 明确 root intent/permissions/acceptance/stop 的 authority;先做保持 intent 的一个 work-graph commit class。普通 Todo 编辑仍走现有 owner,不能给每次 add 强加 amendment 流程。跨共享承诺修改才消费有范围 policy、必要的 verifier、精确 CAS 与 lease-impact disposition。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,16 @@ S11; this RFC does not silently enable a new acceptance policy. The next complet
slice should map existing structured criteria through a work switch and restart,
reject dropped coverage, and invalidate stale evidence under the same owner.

**Supporting-outcome checkpoint:** [default outcome refinement](goal-outcome-refinement-v0.md)
now proposes cumulative requirements and evidence-backed Agent review inside the
same acceptance owner, inline work context and existing frontier replan. This
adds no default enable switch; the legacy switch still controls executable checks.
Self-review cannot bypass configured checks or close a root Goal. Additive
requirements, File/SQLite recovery and runnable-research parity form this slice;
general supersession, global closeout, cross-Agent reassignment and S11 model/
benchmark adoption remain open. This is a disclosed default guidance change,
not qualification of the complete R4 contract.

### 3.8 Invalid evidence and affected consumers

Recovery and work switching must preserve the different observations defined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ canonical acceptance 与当前 Todo 精确详情读取。普通产品 heartbeat
R1/R4/R5 与 S11,本 RFC 不隐式开启新的 acceptance policy。下一完整切片应让既有
结构化 criterion 穿过任务切换和重启,在同一 owner 拒绝覆盖丢失并使过期证据失效。

**支撑成果检查点:** [默认成果细化](goal-outcome-refinement-v0.zh-CN.md) 在同一验收
归属内提出累计要求与有据 Agent 自查,复用内联工作上下文和既有 frontier replan。
默认能力不新增开关,旧开关仍只控制可执行检查。自查不能绕过已配置检查,也不能
结清根 Goal。本切片覆盖只增要求、File/SQLite 恢复和可执行研究续行一致性;
一般替代、全局收口、跨 Agent 转交及 S11 模型/benchmark 采用仍未完成。这是
明确披露的默认指导变化,不代表完整 R4 合同已取得资格。

### 3.8 失效证据与受影响消费者

恢复和工作切换须保留 §3.7 中不同观察的含义。当前 `work_context.complete` 表示
Expand Down
73 changes: 70 additions & 3 deletions docs/reference/contracts/interface-budget-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,63 @@ three affected JSON surfaces; dense-to-dense changes retain ordinary limits.

### Native fixture qualification

The current outcome rollout also affects the complete thin body and emitted
JSON, measured independently. On the same public CLI fixture at main
`4f6e20a13`, normalized body characters are 3,306 before / 3,829 after; the
supported 320-character scope is 3,595 / 4,118. The thin body ceiling becomes
4,200 instead of the original outcome proposal's insufficient 3,700. Final
emitted JSON measures 4,172 normally and 4,461 with that scope; its ceiling
becomes 4,500, leaving 39 characters at the latter boundary. Standard Markdown
is 6,076 characters / 65 lines under the unchanged 6,200 / 72 limits. The body
retains 82 characters of scoped headroom. Full scope and all authority,
continuation, outcome and settlement instructions remain intact.

The 96-row real base/head matrix initially fails 12 heartbeat rows: +523
characters for brief/compact/full and +524 for thin because the overflow flag
changed. With the thin body repaired, its prose growth is also +523. The
existing differential observer records the full frozen pre-outcome rule and
all added outcome clauses, granting at most 544 characters/bytes on those four
heartbeat carriers only for their observed first transition. Partial or missing
clauses, already-upgraded bases, other surfaces and excess growth still fail;
line/shape/semantic-key and absolute limits remain independent.

成果默认闭环还影响 thin 完整正文和实际 JSON,两层分别测量。同一公开 CLI fixture
在 main `4f6e20a13` 上,归一化正文新增前后为 3,306/3,829 字符,受支持的
320 字符 scope 为 3,595/4,118。thin 正文上限从成果原提案不足的 3,700 调至
4,200;最终实际 JSON 普通为 4,172、带该 scope 为 4,461,上限调至 4,500,
后者余量 39 字符。普通 Markdown 为 6,076 字符/65 行,沿用 6,200/72 上限;
scope 正文余量为 82。范围、权限、续行、成果和结算指令全部保留。

96 行真实 base/head 矩阵最初在 12 行 heartbeat 输出失败:brief/compact/full
增加 523 字符,thin 因超限标志变化增加 524;正文修复后 thin 的指令增长同样为
523。既有差分观察器记录完整冻结旧规则及全部新增条款,只在四类 heartbeat 输出
首次观察到这项迁移时允许最多 544 字符/字节。缺失或部分条款、已升级基线、其他
表面和超额增长仍失败;行数、结构、语义键和绝对上限分别保持约束。

The persistent outcome guidance adds 523 characters to the complete heartbeat
rule without deleting earlier instructions. On the unchanged real brief fixture
with a 128-character root, main `4f6e20a13` emits 10,260 JSON / 8,559 Markdown
characters; the outcome candidate emits 10,783 / 9,082. Both fail the former
10,500 / 9,000 output ceilings. The initial outcome qualification used brief
characterization ceilings of 11,100 / 9,600, retaining 317 / 518 characters of
headroom and the existing 58 / 115 line limits. These clauses preserve cumulative
requirements, evidence
review and the distinction between supporting outcomes and root completion.
They serve different decisions from existing continuation/settlement guidance;
full executable paths and requirements remain intact. Other output modes,
machine envelopes, execution quota and permission are separate contracts.
Retain the historical overflows; this is measured presentation growth, not an
efficiency claim or an expansion of model/execution allowance.

持久成果指导给完整 heartbeat 规则增加 523 字符,旧条款全部保留。同一 128 字符
根路径的真实 brief fixture,在 main `4f6e20a13` 为 JSON 10,260/Markdown
8,559 字符,成果候选为 10,783/9,082,均超过旧 10,500/9,000 输出上限。
最初的成果资格检查只把 brief 展示上限调至 11,100/9,600,保留 317/518 字符余量
及原 58/115 行上限。新增条款指导保留累积要求、有据自查和区分支撑成果与根目标完成,与已有
续行/结算指导分别服务不同决定;完整命令路径和要求不删减。其他模式、机器
envelope、执行配额和权限另有合同。保留原始超限,不宣称效率提升或模型/执行
额度扩张。

The probe and its historical base share the current physical fixture-root owner:
POSIX retains `/tmp/loopx-cli-budget-…`; Windows uses an owned directory in its
native temporary root, without requiring a drive-root `tmp` directory. Implicit
Expand Down Expand Up @@ -440,13 +497,23 @@ roots with 7, 13 and 19 separators emit 10,482, 10,602 and 10,722 JSON character
Markdown remains 8,579 characters / 94 lines. Replacing only each owned root
produces identical complete JSON payloads and Markdown; the extra escaping
cost preserves the same executable routes. Hosted main and candidate both
fail the previous 10,500 ceiling at 10,522 characters. The brief JSON ceiling
is now 10,800; Markdown's 9,000 ceiling, line limits, body budgets and other
modes remain unchanged. This qualifies the measured layouts, not arbitrary
fail the previous 10,500 ceiling at 10,522 characters. That path-only
qualification raised the brief JSON ceiling to 10,800 and kept Markdown's
9,000 ceiling. The combined characterization ceilings are 11,400 / 9,600,
applying the outcome qualification's 600-character allowance to those native
path ceilings. This retains the already measured 523-character content delta
and the native escaping allowance; it is budget composition, not a new native
Windows measurement. Line limits, body budgets and other modes retain their
separate contracts. The native measurements qualify those layouts, not arbitrary
path topology. The depth regression enforces raw output sizes; root replacement
is used only for semantic comparison. If the native namespace cannot fit the
depth-12 workload, that comparison reports a skip without shortening its root.

Windows 原生路径资格检查把 brief JSON 上限调至 10,800,Markdown 仍为 9,000。
组合后分别叠加成果指导已资格化的 600 字符余量,展示上限为 11,400/9,600,
同时保留已测 523 字符内容增量和路径转义余量。这是两项预算的组合,不能作为
新的 Windows 原生实测;原始路径测量、行数和语义检查仍保留其各自边界。

Windows qualification can use the existing explicit canary time budget:

```powershell
Expand Down
5 changes: 2 additions & 3 deletions docs/reference/goal-acceptance-observations.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ same feedback loop. An Agent review does
not certify independent acceptance or complete the root Goal; requirements/work
changes invalidate its basis and artifact edits require another review. Other
runnable research and original budget/stop conditions retain precedence.
The native tool and CLI provide inline context and one-call writeback.
Automatic frontier/ACK routing and the external-host workflow are the next
dependent slice; their delivery is qualified separately.
See the [Agent workflow](../../skills/loopx-project/references/outcome-refinement.md)
for inline context, one-call writeback and upgrade/adoption limits.

中文:Goal 概览显示 Agent 登记的支撑成果:原始目的、累计要求、关联工作、来源,
并区分 Agent 自查与独立检查。所有者可原地补充要求并读取原生结果;过期视图先
Expand Down
1 change: 1 addition & 0 deletions loopx/control_plane/coordination/canonical_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ def require(condition: bool, message: str) -> None:
<= {
"todo_read_model",
"goal_acceptance_contract",
"goal_acceptance_oracle_observation_basis",
"handoff_mode",
"projection_readback",
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export async function readCanonicalSnapshotFromStore(value: unknown, store: Auth
after.snapshot.provider_revision === head.provider_revision && after.snapshot.cursor === head.cursor &&
after.snapshot.query_sha256 === query,
"canonical_snapshot_changed", "canonical snapshot changed; restart the complete read, never append a newer page");
const {projection, todoReadModel: readModel, leaseIndex: leases, acceptance} =
const {projection, todoReadModel: readModel, leaseIndex: leases, acceptance, oracleObservationBasis} =
canonicalTodoCollection(head.head, goal, input.include_leases);
const snapshot: Snapshot = {goal_id: goal, store_identity: identity.store_identity,
provider_revision: head.provider_revision, cursor: head.cursor, query_sha256: query,
Expand All @@ -108,6 +108,7 @@ export async function readCanonicalSnapshotFromStore(value: unknown, store: Auth
const todoStart = after?.todo_offset ?? 0, leaseStart = after?.lease_offset ?? 0;
const metadata = {todo_read_model: readModel,
...(!!configuredGoalChecks(acceptance) || acceptance.outcome_requirements ? {goal_acceptance_contract: acceptance} : {}),
...(oracleObservationBasis === null ? {} : {goal_acceptance_oracle_observation_basis: oracleObservationBasis}),
...(leases === null ? {} : {handoff_mode: head.head.handoff_mode ?? "legacy"}),
...(readback === null ? {} : {projection_readback: confirmProjectionReadback(readback, head.provider_revision)})};
function result(chosenTodos: readonly string[], chosenLeases: readonly string[], guards: JsonObject): JsonObject {
Expand Down
7 changes: 5 additions & 2 deletions loopx/control_plane/coordination/local_authority_read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {configuredGoalChecks} from "../goals/acceptance_contract.ts";
import type {JsonObject} from "../effect_program.ts";
import {requireJsonObject} from "../runtime_decode.ts";
import {acceptanceWorkGuard, projectGoalAcceptance,
projectGoalAcceptanceWorkGuards} from "../goals/acceptance_contract.ts";
projectGoalAcceptanceWorkGuards, goalAcceptanceOracleObservationBasis} from "../goals/acceptance_contract.ts";
import {authorityStoreSourceAuthority as sourceAuthorityFor} from "./authority_store.ts";
import {canonicalAuthoritySha256, hasExactAuthorityKeys, parseAuthorityCursor,
requireAuthorityStoreId} from "./authority_store_codec.ts";
Expand All @@ -27,6 +27,8 @@ export function canonicalTodoCollection(head: JsonObject, goalId: string, includ
todoReadModel: read.validateTodoReadModel(),
leaseIndex: includeLeases ? read.coordinationIndex : null,
acceptance,
oracleObservationBasis: acceptance.outcome_requirements
? goalAcceptanceOracleObservationBasis(head, goalId) : null,
};
}

Expand Down Expand Up @@ -312,7 +314,7 @@ export async function listLocalCoordinationTodos(
legacy_fallback_used: false,
};
}
const {projection, todoReadModel, leaseIndex, acceptance} = canonicalTodoCollection(
const {projection, todoReadModel, leaseIndex, acceptance, oracleObservationBasis} = canonicalTodoCollection(
head.head, goalId, input.include_leases === true,
);
return {
Expand All @@ -324,6 +326,7 @@ export async function listLocalCoordinationTodos(
todo_read_model: todoReadModel,
...(!configuredGoalChecks(acceptance) && !acceptance.outcome_requirements ? {} : {goal_acceptance_contract: acceptance,
goal_acceptance_work_guards: projectGoalAcceptanceWorkGuards(head.head, goalId, projection.todo_ids)}),
...(oracleObservationBasis === null ? {} : {goal_acceptance_oracle_observation_basis: oracleObservationBasis}),
...(leaseIndex === null ? {} : {
leases: leaseIndex.lease_todo_ids.map((id) => leaseIndex.leases.get(id)!),
handoff_mode: head.head.handoff_mode ?? "legacy",
Expand Down
18 changes: 18 additions & 0 deletions loopx/control_plane/goals/acceptance.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,24 @@ def observe_goal_acceptance_oracles(
}) if observations else contract


def observe_canonical_goal_acceptance(
canonical: dict[str, Any], *, registry_path: Path | None, goal_id: str,
) -> dict[str, Any] | None:
"""Add current host observations to this exact canonical planning read.

The private basis only carries configured oracle refs. The original source
snapshot and its provider identity remain unchanged for historical replay.
"""
acceptance = canonical.get("goal_acceptance_contract")
oracle_basis = canonical.get("goal_acceptance_oracle_observation_basis")
if oracle_basis is None:
return acceptance
if not isinstance(acceptance, dict) or not isinstance(oracle_basis, dict) or any(
oracle_basis.get(key) != acceptance.get(key) for key in ("revision", "digest")
) or not isinstance(oracle_basis.get("criteria"), list):
raise ValueError("oracle observation basis does not match the canonical acceptance snapshot")
return observe_goal_acceptance_oracles(registry_path=registry_path, goal_id=goal_id,
contract=acceptance, criteria=oracle_basis["criteria"])


def _criterion_effects(criteria: list[dict[str, Any]]) -> list[dict[str, Any]]:
Expand Down
Loading
Loading