diff --git a/src/inferrsi/knowledge/atomic_build.py b/src/inferrsi/knowledge/atomic_build.py index 0c446ca2f..a74a9a6af 100644 --- a/src/inferrsi/knowledge/atomic_build.py +++ b/src/inferrsi/knowledge/atomic_build.py @@ -13,7 +13,7 @@ from .atomic_generation import FORMAT, PUBLIC_TASKS, SEAL, InstalledGeneration, digest, owned_path from .atomic_json import matches_span, member_spans from .atomic_reader import atom_material, permits_operations -from .atomic_skill_directory import directory_content, export_directory_skill, skill_spans +from .atomic_skill_directory import directory_dependencies, export_directory_skill, skill_spans from .decision_cards import DecisionSource from .knowledge_operations import IDENTITY, Bundle, _json, case_required_resources, safe_path from .skill_catalog import _frontmatter_parts @@ -151,9 +151,15 @@ def _authored(directory, path, field, descriptor, material, roots) -> tuple[Atom if field not in metadata or ("atom" in metadata and "composition" in metadata): raise ValueError(f"{path.name} must declare one {field}") content = {} - directory_export = metadata[field].get("skill") == {"directory_entry": True} - if directory_export and "directory_resources" not in descriptor: - raise ValueError("Directory Skill export requires checked original directory resources") + dependencies = descriptor.get("dependencies", {}) + directory_required = metadata[field].get("skill") == {"directory_entry": True} + if (field == "composition" and metadata["kind"] == "skill" + and descriptor.get("authority") == "checkout"): + original = next(iter(metadata.get("sources", [])), {}).get("path", "") + guide = PurePosixPath(metadata.get("entrypoint", "")).name == "SKILL.md" + directory_required |= guide or original.endswith(f"/{metadata['id']}/SKILL.md") + if directory_required and "directory_resources" not in descriptor: + raise ValueError("Directory Skill requires checked original directory resources") if "case_resources" in descriptor: if field != "composition" or metadata["kind"] != "case" or "content" in descriptor: raise ValueError("Only a Case composition may bind its content through case_resources") @@ -161,13 +167,13 @@ def _authored(directory, path, field, descriptor, material, roots) -> tuple[Atom if "directory_resources" in descriptor: if (field != "composition" or metadata["kind"] != "skill" or descriptor.get("authority") != "checkout" or "content" in descriptor - or descriptor.get("dependencies")): - raise ValueError("Directory resources require a self-contained checkout Skill") + or dependencies): + raise ValueError("Checkout Skill directories must use source-declared dependencies") bindings = descriptor["directory_resources"] if not isinstance(bindings, dict): raise ValueError("Skill directory resources must bind original relative names") content, origins = _pinned_resources(metadata, bindings, material) - content = directory_content(metadata, bindings, content, origins, material, roots) + dependencies = directory_dependencies(metadata, bindings, content, origins, material, roots) for name, value in descriptor.get("content", {}).items(): safe_path(name) if isinstance(value, dict) and value.keys() == {"path"}: @@ -186,7 +192,7 @@ def _authored(directory, path, field, descriptor, material, roots) -> tuple[Atom if "navigation.json" in content: raise ValueError("Explicit navigation content must declare its entrypoint") content["navigation.json"] = _json(metadata[field]) - bundle = Bundle(metadata, content, descriptor.get("dependencies", {})) + bundle = Bundle(metadata, content, dependencies) ref = descriptor.get("authority", "package") + ":" + metadata["id"] return AtomPin(ref, bundle.revision), bundle diff --git a/src/inferrsi/knowledge/atomic_skill_directory.py b/src/inferrsi/knowledge/atomic_skill_directory.py index 3a61e7c90..2b5f5932d 100644 --- a/src/inferrsi/knowledge/atomic_skill_directory.py +++ b/src/inferrsi/knowledge/atomic_skill_directory.py @@ -8,7 +8,7 @@ from ._skill_selection import skill_procedure from .atomic_composition import AtomPin, select_routes -from .atomic_generation import directory_skill_path, owned_path +from .atomic_generation import digest, directory_skill_path, owned_path from .knowledge_operations import Bundle, _tree, safe_path from .skill_catalog import _effective, _frontmatter_parts @@ -27,21 +27,26 @@ def skill_spans(body: bytes) -> dict: "procedure": ("L2", header.end(), len(body))} -def _verify_directory_routes(declaration, bindings, guide, source, material): +def _verify_directory_routes(declaration, bindings, guide, source, material, dependencies): sections = skill_spans(guide) if any(any(route.get(key) for key in ("when", "optional", "supersedes", "conflicts")) for route in declaration["routes"].values()): raise ValueError("Directory routes must preserve their unconditional delivery") nodes = declaration["nodes"] - originals = {AtomPin(nodes[name]["ref"], nodes[name]["revision"]) for name in bindings.values()} + file_pins = {path: AtomPin(nodes[name]["ref"], nodes[name]["revision"]) + for path, name in bindings.items()} for layer, names in (("L0", ["navigation"]), ("L1", ["decision"]), ("L2", ["decision", "procedure"]), ("L3", [])): selected = select_routes(declaration, layer=layer, context={}, case=None, finding=None) - pins = dict.fromkeys(use.pin for use in selected.required) + pins = list(dict.fromkeys(use.pin for use in selected.required)) if layer == "L3": - if pins.keys() != originals: + if set(pins) != set(file_pins.values()): raise ValueError("Skill L3 must deliver the complete original directory") continue + if layer == "L2": + if pins[len(names):] != [file_pins[path] for path in dependencies]: + raise ValueError("Skill L2 must deliver its declared original references") + pins = pins[:len(names)] actual = [] for pin in pins: if pin not in material: @@ -54,8 +59,8 @@ def _verify_directory_routes(declaration, bindings, guide, source, material): raise ValueError(f"Skill {layer} must deliver its own pinned guide sections") -def directory_content(metadata, bindings, content, origins, material, roots) -> dict[str, bytes]: - """Keep all the original names and bytes of a self-contained checkout Skill directory.""" +def directory_dependencies(metadata, bindings, content, origins, material, roots) -> dict[str, str]: + """Verify the original Skill directory and derive the explicitly declared file revisions.""" entry = PurePosixPath(safe_path(metadata["entrypoint"])) if (not isinstance(bindings, dict) or entry.as_posix() not in bindings or entry.name != "SKILL.md" or entry.parent.name != metadata["id"]): @@ -74,14 +79,18 @@ def directory_content(metadata, bindings, content, origins, material, roots) -> raise ValueError(f"Skill resource differs from its original relative source: {name}") root = roots[source["commit"]] directory = owned_path(root, original.parent.as_posix()) - if _effective(directory).get("references"): - raise ValueError("Self-contained directory cannot omit declared Skill references") released = _tree(directory, entry.parent.as_posix(), root=root) if content != released or metadata["required_resources"] != sorted(released): raise ValueError("Skill directory bindings must cover the complete original directory") + dependencies = {} + for reference in _effective(directory).get("references", []): + path = (entry.parent / safe_path(reference)).as_posix() + if path not in released: + raise ValueError(f"Missing declared Skill reference: {path}") + dependencies[path] = "sha256:" + digest(released[path]) _verify_directory_routes(metadata["composition"], bindings, content[entry.as_posix()], - source, material) - return content + source, material, dependencies) + return dependencies def export_directory_skill(bundle: Bundle) -> tuple[str, dict[str, bytes]]: diff --git a/src/inferrsi/knowledge/atoms/draft-acceptance-issue.original.json b/src/inferrsi/knowledge/atoms/draft-acceptance-issue.original.json new file mode 100644 index 000000000..42076f0cc --- /dev/null +++ b/src/inferrsi/knowledge/atoms/draft-acceptance-issue.original.json @@ -0,0 +1,100 @@ +{ + "authority": "checkout", + "metadata": { + "id": "draft-acceptance-issue.original", + "kind": "knowledge", + "entrypoint": "guide.md", + "title": "Draft a campaign acceptance issue with checklist, RunSpec, evidence paths, and placeholders for baseline/candidate SHAs.", + "origin": [ + "first-party" + ], + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/draft-acceptance-issue/SKILL.md", + "sha256": "2c14533c067c51b9763f80a9df0bf5eb5acd398f4265790c57039fed96d4c497" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "applicability": { + "scope": "Opening a new acceptance campaign in an RSI-style repository, before any baseline or candidate run", + "prerequisites": "A chosen campaign subject and an empty evidence// tree copied from evidence/_template/; SHAs may still be placeholders", + "input_contract": "A campaign id of the form {model-or-scenario}/{device}x{count}, any user-supplied criteria or accepted plan, and available workload/baseline/calibration evidence for deriving missing targets", + "produced_artifact": "An acceptance issue body with campaign id, pinned baseline and candidate SHAs, RunSpec, criteria source and derivation including gaps and freeze authority, gates, evidence paths, initial verdict and a downstream citation blurb", + "failure_modes": [ + "Gates written after the search loop has already run", + "Campaign SHAs committed into recipes/, benchmarks/, skills or workflow defaults", + "PASS claimed without a validator/ freeze and a results/ rationale" + ], + "refusal_point": "Refuses to state a verdict other than INCONCLUSIVE while the validator freeze or results rationale is absent" + }, + "state": "candidate", + "limitations": [ + "Drafts an issue only; it freezes no gate and runs no measurement.", + "The placeholder SHA convention depends on the campaign owner filling them in later.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/draft-acceptance-issue/SKILL.md", + "byte_range": [ + 0, + 4373 + ], + "sha256": "2c14533c067c51b9763f80a9df0bf5eb5acd398f4265790c57039fed96d4c497" + } + } + }, + "content": { + "guide.md": { + "path": "workflows/draft-acceptance-issue.md" + } + }, + "parts": { + "navigation": { + "skill_section": "navigation", + "layer": "L0", + "byte_range": [ + 0, + 167 + ], + "sha256": "58706d39daa9a09f6ffe2e9fc498095e8431b8bb31bc277d244e334704683c75" + }, + "decision": { + "skill_section": "decision", + "layer": "L1", + "byte_range": [ + 0, + 2861 + ], + "sha256": "8e6793ae5ee565507a43588828c25e66a7fd1d32fac153b5f7be76b72bcf3277" + }, + "procedure": { + "skill_section": "procedure", + "layer": "L2", + "byte_range": [ + 2861, + 4373 + ], + "sha256": "fe9aa75697f5223bf61fb31b6eeec4ee8a1983891545398bdeeed8cb5a5e0700" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/repository-evolution-analysis.capability-presence-audit.json b/src/inferrsi/knowledge/atoms/repository-evolution-analysis.capability-presence-audit.json new file mode 100644 index 000000000..e01bd2983 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/repository-evolution-analysis.capability-presence-audit.json @@ -0,0 +1,128 @@ +{ + "authority": "checkout", + "metadata": { + "title": "Capability presence audit", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/research/repository-evolution-analysis/references/capability-presence-audit.md", + "sha256": "c21eb4a6aabe811a49a6540a34c54dbcfdcf7efae3052a79b54034c7838026a5" + } + ], + "origin": [ + "external" + ], + "attribution": [ + { + "url": "https://github.com/LearningToCommit/LearningToCommit", + "commit": "7e5a1d77", + "paths": [ + "data_construction/s1_scan_commits.py", + "data_construction/s3_tag.py", + "data_construction/s4_sample.py", + "data_construction/s5_build.py", + "modules/agent.py", + "modules/prompt_builder.py", + "modules/trajectory_to_md.py", + "system_prompts/solve_with_skill.txt", + "system_prompts/learn_reflect.txt", + "evaluation/pairwise_judge.py", + "evaluation/programmatic_metrics.py" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "77800032", + "paths": [ + "internal/", + "docs/" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "4b5d6d725fae3d8a263f6e43c707400e3765b84f", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go" + ], + "type": "git", + "revision_precision": "full" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "9848a9062a65c49e074c09770dc7de73dd012bea", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go", + "internal/library/rtk_path.go", + "internal/library/rtk_path_other.go", + "internal/library/rtk_path_windows.go", + "internal/library/rtk_path_test.go", + "internal/library/rtk_test.go", + "internal/library/rtk_upgrade_test.go", + "internal/library/library_test.go", + "internal/gui/library.go", + "internal/gui/assets/library.js", + "internal/gui/tests/library-rtk-path.test.cjs", + "library_cli.go", + "LICENSE" + ], + "type": "git", + "revision_precision": "full" + } + ], + "applicability": { + "scope": "any software repository with a recoverable git history", + "prerequisites": "git history access, optionally LearningToCommit-style benchmark for evaluation" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "The RTK transition is a learning example, not an independent heldout task; upstream tests were inspected, not executed.", + "Existing audit and synthetic KV comparison adapters are not a generic historical coding-task evaluator.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "empirical_validation": "not_run", + "id": "repository-evolution-analysis.capability-presence-audit", + "kind": "knowledge", + "entrypoint": "capability-presence-audit.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/research/repository-evolution-analysis/references/capability-presence-audit.md", + "byte_range": [ + 0, + 11461 + ], + "sha256": "c21eb4a6aabe811a49a6540a34c54dbcfdcf7efae3052a79b54034c7838026a5" + } + } + }, + "content": { + "capability-presence-audit.md": { + "path": "workflows/repository-evolution-analysis/references/capability-presence-audit.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/repository-evolution-analysis.original.json b/src/inferrsi/knowledge/atoms/repository-evolution-analysis.original.json new file mode 100644 index 000000000..c3e1fa78c --- /dev/null +++ b/src/inferrsi/knowledge/atoms/repository-evolution-analysis.original.json @@ -0,0 +1,224 @@ +{ + "authority": "checkout", + "metadata": { + "id": "repository-evolution-analysis.original", + "kind": "knowledge", + "entrypoint": "guide.md", + "title": "Analyze a repository's commit history to build a capability-evolution model: what the system can do, how it got there, and what patterns allow it to iterate quickly. Use to produce history-derived knowledge for agent skill conditioning, and to design temporal-split benchmarks for skill evaluation.\n", + "origin": [ + "external" + ], + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/research/repository-evolution-analysis/SKILL.md", + "sha256": "0f48cc6a77b3ac861af698048be7c250c3ef5c225dc238b9a0e6d71208cbd93e" + }, + { + "url": "https://github.com/LearningToCommit/LearningToCommit", + "commit": "7e5a1d77", + "paths": [ + "data_construction/s1_scan_commits.py", + "data_construction/s3_tag.py", + "data_construction/s4_sample.py", + "data_construction/s5_build.py", + "modules/agent.py", + "modules/prompt_builder.py", + "modules/trajectory_to_md.py", + "system_prompts/solve_with_skill.txt", + "system_prompts/learn_reflect.txt", + "evaluation/pairwise_judge.py", + "evaluation/programmatic_metrics.py" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "77800032", + "paths": [ + "internal/", + "docs/" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "4b5d6d725fae3d8a263f6e43c707400e3765b84f", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go" + ], + "type": "git", + "revision_precision": "full" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "9848a9062a65c49e074c09770dc7de73dd012bea", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go", + "internal/library/rtk_path.go", + "internal/library/rtk_path_other.go", + "internal/library/rtk_path_windows.go", + "internal/library/rtk_path_test.go", + "internal/library/rtk_test.go", + "internal/library/rtk_upgrade_test.go", + "internal/library/library_test.go", + "internal/gui/library.go", + "internal/gui/assets/library.js", + "internal/gui/tests/library-rtk-path.test.cjs", + "library_cli.go", + "LICENSE" + ], + "type": "git", + "revision_precision": "full" + } + ], + "applicability": { + "scope": "any software repository with a recoverable git history", + "prerequisites": "git history access, optionally LearningToCommit-style benchmark for evaluation" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "The RTK transition is a learning example, not an independent heldout task; upstream tests were inspected, not executed.", + "Existing audit and synthetic KV comparison adapters are not a generic historical coding-task evaluator.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [ + { + "url": "https://github.com/LearningToCommit/LearningToCommit", + "commit": "7e5a1d77", + "paths": [ + "data_construction/s1_scan_commits.py", + "data_construction/s3_tag.py", + "data_construction/s4_sample.py", + "data_construction/s5_build.py", + "modules/agent.py", + "modules/prompt_builder.py", + "modules/trajectory_to_md.py", + "system_prompts/solve_with_skill.txt", + "system_prompts/learn_reflect.txt", + "evaluation/pairwise_judge.py", + "evaluation/programmatic_metrics.py" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "77800032", + "paths": [ + "internal/", + "docs/" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "4b5d6d725fae3d8a263f6e43c707400e3765b84f", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go" + ], + "type": "git", + "revision_precision": "full" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "9848a9062a65c49e074c09770dc7de73dd012bea", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go", + "internal/library/rtk_path.go", + "internal/library/rtk_path_other.go", + "internal/library/rtk_path_windows.go", + "internal/library/rtk_path_test.go", + "internal/library/rtk_test.go", + "internal/library/rtk_upgrade_test.go", + "internal/library/library_test.go", + "internal/gui/library.go", + "internal/gui/assets/library.js", + "internal/gui/tests/library-rtk-path.test.cjs", + "library_cli.go", + "LICENSE" + ], + "type": "git", + "revision_precision": "full" + } + ], + "empirical_validation": "not_run", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/research/repository-evolution-analysis/SKILL.md", + "byte_range": [ + 0, + 22892 + ], + "sha256": "0f48cc6a77b3ac861af698048be7c250c3ef5c225dc238b9a0e6d71208cbd93e" + } + } + }, + "content": { + "guide.md": { + "path": "workflows/repository-evolution-analysis.md" + } + }, + "parts": { + "navigation": { + "skill_section": "navigation", + "layer": "L0", + "byte_range": [ + 0, + 359 + ], + "sha256": "7d51fa6362de3f3fe6da29fddbb4825077593ae7e8167f66fb93767ebd9117b6" + }, + "decision": { + "skill_section": "decision", + "layer": "L1", + "byte_range": [ + 0, + 4449 + ], + "sha256": "7ced3a4f8df07fdea06e5e8a379fe2ec6491eb739f50368384fdb45ef08a7e4c" + }, + "procedure": { + "skill_section": "procedure", + "layer": "L2", + "byte_range": [ + 4449, + 22892 + ], + "sha256": "b4b1e3f25edee40978060a3cc1613af09d5e0b8d3854d08545619f60f04990ef" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/repository-evolution-analysis.rtk-consumer-path-transition.json b/src/inferrsi/knowledge/atoms/repository-evolution-analysis.rtk-consumer-path-transition.json new file mode 100644 index 000000000..8fad6446c --- /dev/null +++ b/src/inferrsi/knowledge/atoms/repository-evolution-analysis.rtk-consumer-path-transition.json @@ -0,0 +1,128 @@ +{ + "authority": "checkout", + "metadata": { + "title": "Worked transition: manager discovery is not consumer reachability", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/research/repository-evolution-analysis/references/rtk-consumer-path-transition.md", + "sha256": "a70b1d128fb5e0ac12292a290d624f218a0831d7581fe8980b62661473e0f2b7" + } + ], + "origin": [ + "external" + ], + "attribution": [ + { + "url": "https://github.com/LearningToCommit/LearningToCommit", + "commit": "7e5a1d77", + "paths": [ + "data_construction/s1_scan_commits.py", + "data_construction/s3_tag.py", + "data_construction/s4_sample.py", + "data_construction/s5_build.py", + "modules/agent.py", + "modules/prompt_builder.py", + "modules/trajectory_to_md.py", + "system_prompts/solve_with_skill.txt", + "system_prompts/learn_reflect.txt", + "evaluation/pairwise_judge.py", + "evaluation/programmatic_metrics.py" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "77800032", + "paths": [ + "internal/", + "docs/" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "4b5d6d725fae3d8a263f6e43c707400e3765b84f", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go" + ], + "type": "git", + "revision_precision": "full" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "9848a9062a65c49e074c09770dc7de73dd012bea", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go", + "internal/library/rtk_path.go", + "internal/library/rtk_path_other.go", + "internal/library/rtk_path_windows.go", + "internal/library/rtk_path_test.go", + "internal/library/rtk_test.go", + "internal/library/rtk_upgrade_test.go", + "internal/library/library_test.go", + "internal/gui/library.go", + "internal/gui/assets/library.js", + "internal/gui/tests/library-rtk-path.test.cjs", + "library_cli.go", + "LICENSE" + ], + "type": "git", + "revision_precision": "full" + } + ], + "applicability": { + "scope": "any software repository with a recoverable git history", + "prerequisites": "git history access, optionally LearningToCommit-style benchmark for evaluation" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "The RTK transition is a learning example, not an independent heldout task; upstream tests were inspected, not executed.", + "Existing audit and synthetic KV comparison adapters are not a generic historical coding-task evaluator.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "empirical_validation": "not_run", + "id": "repository-evolution-analysis.rtk-consumer-path-transition", + "kind": "knowledge", + "entrypoint": "rtk-consumer-path-transition.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/research/repository-evolution-analysis/references/rtk-consumer-path-transition.md", + "byte_range": [ + 0, + 13701 + ], + "sha256": "a70b1d128fb5e0ac12292a290d624f218a0831d7581fe8980b62661473e0f2b7" + } + } + }, + "content": { + "rtk-consumer-path-transition.md": { + "path": "workflows/repository-evolution-analysis/references/rtk-consumer-path-transition.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/rsi-evidence.decision-cases.json b/src/inferrsi/knowledge/atoms/rsi-evidence.decision-cases.json new file mode 100644 index 000000000..16673255e --- /dev/null +++ b/src/inferrsi/knowledge/atoms/rsi-evidence.decision-cases.json @@ -0,0 +1,85 @@ +{ + "authority": "checkout", + "metadata": { + "title": "Decision cases", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/decision-cases.md", + "sha256": "c2c1d3d75c4fcb515dd36ff84d8dc940c25d54c5757a29a80d1af88eb8b66115" + }, + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9" + } + ], + "origin": [ + "first-party" + ], + "attribution": [ + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9" + } + ], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "state": "candidate", + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store.", + "Original-byte identity authenticates file contents, not full-file semantic review; inspected_scope states the actual readset.", + "Python source preparation and TypeScript decisions/accounting remain distinct; no pure Python quota kernel is extracted.", + "Local accounting idempotency and repair do not establish external exactly-once execution or supplier hard cost ceilings.", + "This candidate does not implement InferRSI goal checkpoints or promote the inherited owner." + ], + "empirical_validation": "not_run", + "id": "rsi-evidence.decision-cases", + "kind": "knowledge", + "entrypoint": "decision-cases.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/decision-cases.md", + "byte_range": [ + 0, + 7035 + ], + "sha256": "c2c1d3d75c4fcb515dd36ff84d8dc940c25d54c5757a29a80d1af88eb8b66115" + } + } + }, + "content": { + "decision-cases.md": { + "path": "workflows/rsi-evidence/references/loopx-goal-governance/decision-cases.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/rsi-evidence.license-mit.json b/src/inferrsi/knowledge/atoms/rsi-evidence.license-mit.json new file mode 100644 index 000000000..5f9fce924 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/rsi-evidence.license-mit.json @@ -0,0 +1,89 @@ +{ + "authority": "checkout", + "metadata": { + "title": "LoopX historical MIT license", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/LICENSE-MIT.md", + "sha256": "1df1cf519b9e5d8acbbc72820299d7aa95afa1acbfc1f43a15109ad1d59975f3" + }, + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9", + "path": "LICENSE-MIT", + "sha256": "1df1cf519b9e5d8acbbc72820299d7aa95afa1acbfc1f43a15109ad1d59975f3" + } + ], + "origin": [ + "external" + ], + "attribution": [ + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9", + "path": "LICENSE-MIT", + "sha256": "1df1cf519b9e5d8acbbc72820299d7aa95afa1acbfc1f43a15109ad1d59975f3" + } + ], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "state": "candidate", + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store.", + "Original-byte identity authenticates file contents, not full-file semantic review; inspected_scope states the actual readset.", + "Python source preparation and TypeScript decisions/accounting remain distinct; no pure Python quota kernel is extracted.", + "Local accounting idempotency and repair do not establish external exactly-once execution or supplier hard cost ceilings.", + "This candidate does not implement InferRSI goal checkpoints or promote the inherited owner." + ], + "empirical_validation": "not_run", + "id": "rsi-evidence.license-mit", + "kind": "knowledge", + "entrypoint": "LICENSE-MIT.md", + "atom": { + "when": {}, + "license": "MIT", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/LICENSE-MIT.md", + "byte_range": [ + 0, + 1075 + ], + "sha256": "1df1cf519b9e5d8acbbc72820299d7aa95afa1acbfc1f43a15109ad1d59975f3" + } + } + }, + "content": { + "LICENSE-MIT.md": { + "path": "workflows/rsi-evidence/references/loopx-goal-governance/LICENSE-MIT.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/rsi-evidence.license.json b/src/inferrsi/knowledge/atoms/rsi-evidence.license.json new file mode 100644 index 000000000..76a7f7354 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/rsi-evidence.license.json @@ -0,0 +1,89 @@ +{ + "authority": "checkout", + "metadata": { + "title": "LoopX Apache License 2.0", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/LICENSE", + "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + }, + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9", + "path": "LICENSE", + "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + } + ], + "origin": [ + "external" + ], + "attribution": [ + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9", + "path": "LICENSE", + "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + } + ], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "state": "candidate", + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store.", + "Original-byte identity authenticates file contents, not full-file semantic review; inspected_scope states the actual readset.", + "Python source preparation and TypeScript decisions/accounting remain distinct; no pure Python quota kernel is extracted.", + "Local accounting idempotency and repair do not establish external exactly-once execution or supplier hard cost ceilings.", + "This candidate does not implement InferRSI goal checkpoints or promote the inherited owner." + ], + "empirical_validation": "not_run", + "id": "rsi-evidence.license", + "kind": "knowledge", + "entrypoint": "LICENSE", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/LICENSE", + "byte_range": [ + 0, + 11358 + ], + "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30" + } + } + }, + "content": { + "LICENSE": { + "path": "workflows/rsi-evidence/references/loopx-goal-governance/LICENSE" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/rsi-evidence.mechanisms.json b/src/inferrsi/knowledge/atoms/rsi-evidence.mechanisms.json new file mode 100644 index 000000000..ae3090b92 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/rsi-evidence.mechanisms.json @@ -0,0 +1,85 @@ +{ + "authority": "checkout", + "metadata": { + "title": "Mechanisms and operating boundaries", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/mechanisms.md", + "sha256": "4fa09099d362a8088fdb0e6a767f72aae6218b92fe5fd75b6fb78c2bb2a318fb" + }, + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9" + } + ], + "origin": [ + "first-party" + ], + "attribution": [ + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9" + } + ], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "state": "candidate", + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store.", + "Original-byte identity authenticates file contents, not full-file semantic review; inspected_scope states the actual readset.", + "Python source preparation and TypeScript decisions/accounting remain distinct; no pure Python quota kernel is extracted.", + "Local accounting idempotency and repair do not establish external exactly-once execution or supplier hard cost ceilings.", + "This candidate does not implement InferRSI goal checkpoints or promote the inherited owner." + ], + "empirical_validation": "not_run", + "id": "rsi-evidence.mechanisms", + "kind": "knowledge", + "entrypoint": "mechanisms.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/mechanisms.md", + "byte_range": [ + 0, + 16696 + ], + "sha256": "4fa09099d362a8088fdb0e6a767f72aae6218b92fe5fd75b6fb78c2bb2a318fb" + } + } + }, + "content": { + "mechanisms.md": { + "path": "workflows/rsi-evidence/references/loopx-goal-governance/mechanisms.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/rsi-evidence.notice.json b/src/inferrsi/knowledge/atoms/rsi-evidence.notice.json new file mode 100644 index 000000000..04a430b85 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/rsi-evidence.notice.json @@ -0,0 +1,89 @@ +{ + "authority": "checkout", + "metadata": { + "title": "LoopX copyright and contributor notice", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/NOTICE.md", + "sha256": "3c3c36a40e1d65f3a6b20ec3a97319cb753e857f1d120f302cd828e107120f6d" + }, + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9", + "path": "NOTICE", + "sha256": "3c3c36a40e1d65f3a6b20ec3a97319cb753e857f1d120f302cd828e107120f6d" + } + ], + "origin": [ + "external" + ], + "attribution": [ + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9", + "path": "NOTICE", + "sha256": "3c3c36a40e1d65f3a6b20ec3a97319cb753e857f1d120f302cd828e107120f6d" + } + ], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "state": "candidate", + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store.", + "Original-byte identity authenticates file contents, not full-file semantic review; inspected_scope states the actual readset.", + "Python source preparation and TypeScript decisions/accounting remain distinct; no pure Python quota kernel is extracted.", + "Local accounting idempotency and repair do not establish external exactly-once execution or supplier hard cost ceilings.", + "This candidate does not implement InferRSI goal checkpoints or promote the inherited owner." + ], + "empirical_validation": "not_run", + "id": "rsi-evidence.notice", + "kind": "knowledge", + "entrypoint": "NOTICE.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/NOTICE.md", + "byte_range": [ + 0, + 308 + ], + "sha256": "3c3c36a40e1d65f3a6b20ec3a97319cb753e857f1d120f302cd828e107120f6d" + } + } + }, + "content": { + "NOTICE.md": { + "path": "workflows/rsi-evidence/references/loopx-goal-governance/NOTICE.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/rsi-evidence.omni-experiments.json b/src/inferrsi/knowledge/atoms/rsi-evidence.omni-experiments.json new file mode 100644 index 000000000..1d704bced --- /dev/null +++ b/src/inferrsi/knowledge/atoms/rsi-evidence.omni-experiments.json @@ -0,0 +1,70 @@ +{ + "authority": "checkout", + "metadata": { + "title": "Qualifying Omni optimization experiments", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/omni-experiments.md", + "sha256": "8fafc1e05ef21ab60158fc626c73ca1b8c615ada59f90fd23199496daa46ac48" + } + ], + "origin": [ + "first-party" + ], + "attribution": [], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "state": "candidate", + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "empirical_validation": "not_run", + "id": "rsi-evidence.omni-experiments", + "kind": "knowledge", + "entrypoint": "omni-experiments.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/omni-experiments.md", + "byte_range": [ + 0, + 5380 + ], + "sha256": "8fafc1e05ef21ab60158fc626c73ca1b8c615ada59f90fd23199496daa46ac48" + } + } + }, + "content": { + "omni-experiments.md": { + "path": "workflows/rsi-evidence/references/omni-experiments.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/rsi-evidence.original.json b/src/inferrsi/knowledge/atoms/rsi-evidence.original.json new file mode 100644 index 000000000..3926472db --- /dev/null +++ b/src/inferrsi/knowledge/atoms/rsi-evidence.original.json @@ -0,0 +1,103 @@ +{ + "authority": "checkout", + "metadata": { + "id": "rsi-evidence.original", + "kind": "knowledge", + "entrypoint": "guide.md", + "title": "Guide agents to establish acceptance criteria, freeze and cite RSI evidence using plan/results/patch/validator paths and PASS/FAIL/INCONCLUSIVE verdicts.", + "origin": [ + "first-party" + ], + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/SKILL.md", + "sha256": "5edd2bd544da050d2688f37c85ae6e7927eaee24af764e3c96b6cec04982990a" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "state": "candidate", + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/SKILL.md", + "byte_range": [ + 0, + 8927 + ], + "sha256": "5edd2bd544da050d2688f37c85ae6e7927eaee24af764e3c96b6cec04982990a" + } + } + }, + "content": { + "guide.md": { + "path": "workflows/rsi-evidence.md" + } + }, + "parts": { + "navigation": { + "skill_section": "navigation", + "layer": "L0", + "byte_range": [ + 0, + 190 + ], + "sha256": "1ddee4264095fa092d0b18c31699b9ffa746a9fab278e48e29cfc960e68969bb" + }, + "decision": { + "skill_section": "decision", + "layer": "L1", + "byte_range": [ + 0, + 3393 + ], + "sha256": "d4e538e3a4081737a2110aa9c9e4b9aae5ef6cd0af9073433a2e22f16007c69e" + }, + "procedure": { + "skill_section": "procedure", + "layer": "L2", + "byte_range": [ + 3393, + 8927 + ], + "sha256": "f4e849f901ce9eff3f0f6fab396095da45e2859124626c8dc478c1b696b5398b" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/rsi-evidence.readme.json b/src/inferrsi/knowledge/atoms/rsi-evidence.readme.json new file mode 100644 index 000000000..b80996d4a --- /dev/null +++ b/src/inferrsi/knowledge/atoms/rsi-evidence.readme.json @@ -0,0 +1,85 @@ +{ + "authority": "checkout", + "metadata": { + "title": "LoopX Goal authority and quota boundaries", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/README.md", + "sha256": "c86eb179cea1b42f346f5c1dc076292ba086be907f20b0beee45c43cf0f8d6fe" + }, + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9" + } + ], + "origin": [ + "first-party" + ], + "attribution": [ + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9" + } + ], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "state": "candidate", + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store.", + "Original-byte identity authenticates file contents, not full-file semantic review; inspected_scope states the actual readset.", + "Python source preparation and TypeScript decisions/accounting remain distinct; no pure Python quota kernel is extracted.", + "Local accounting idempotency and repair do not establish external exactly-once execution or supplier hard cost ceilings.", + "This candidate does not implement InferRSI goal checkpoints or promote the inherited owner." + ], + "empirical_validation": "not_run", + "id": "rsi-evidence.readme", + "kind": "knowledge", + "entrypoint": "README.md", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/README.md", + "byte_range": [ + 0, + 4701 + ], + "sha256": "c86eb179cea1b42f346f5c1dc076292ba086be907f20b0beee45c43cf0f8d6fe" + } + } + }, + "content": { + "README.md": { + "path": "workflows/rsi-evidence/references/loopx-goal-governance/README.md" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/rsi-evidence.source-ledger.json b/src/inferrsi/knowledge/atoms/rsi-evidence.source-ledger.json new file mode 100644 index 000000000..4b030afc7 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/rsi-evidence.source-ledger.json @@ -0,0 +1,85 @@ +{ + "authority": "checkout", + "metadata": { + "title": "LoopX source ledger", + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/source-ledger.json", + "sha256": "4a0f1f02134af5b7d54a1f13e104b8066372d3d4a1a4a9e717514632fff05893" + }, + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9" + } + ], + "origin": [ + "first-party" + ], + "attribution": [ + { + "type": "git", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9" + } + ], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "state": "candidate", + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store.", + "Original-byte identity authenticates file contents, not full-file semantic review; inspected_scope states the actual readset.", + "Python source preparation and TypeScript decisions/accounting remain distinct; no pure Python quota kernel is extracted.", + "Local accounting idempotency and repair do not establish external exactly-once execution or supplier hard cost ceilings.", + "This candidate does not implement InferRSI goal checkpoints or promote the inherited owner." + ], + "empirical_validation": "not_run", + "id": "rsi-evidence.source-ledger", + "kind": "knowledge", + "entrypoint": "source-ledger.json", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/references/loopx-goal-governance/source-ledger.json", + "byte_range": [ + 0, + 20966 + ], + "sha256": "4a0f1f02134af5b7d54a1f13e104b8066372d3d4a1a4a9e717514632fff05893" + } + } + }, + "content": { + "source-ledger.json": { + "path": "workflows/rsi-evidence/references/loopx-goal-governance/source-ledger.json" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/skill-evolution-playbook.original.json b/src/inferrsi/knowledge/atoms/skill-evolution-playbook.original.json new file mode 100644 index 000000000..70e1a88fb --- /dev/null +++ b/src/inferrsi/knowledge/atoms/skill-evolution-playbook.original.json @@ -0,0 +1,104 @@ +{ + "authority": "checkout", + "metadata": { + "id": "skill-evolution-playbook.original", + "kind": "knowledge", + "entrypoint": "guide.md", + "title": "Practical design choices for evolving agent skills from execution traces: when one trajectory should update a skill, how conflicting lessons are handled, how negative evidence is preserved, how large an edit should be, and when skills should split or merge. Drawn from Trace2Skill and SkillOpt. Use when designing or operating a skill evolution pipeline.\n", + "origin": [ + "external" + ], + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/maintenance/skill-evolution-playbook/SKILL.md", + "sha256": "f988a0569be93fec550da52484d22d970b0a6c31394ea463ad6ee40e0877ede6" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "applicability": { + "scope": "Design choices for evolving agent skills from execution traces, drawn from Trace2Skill and SkillOpt: when a trajectory should update a skill, how conflicting lessons are handled, how negative evidence is preserved, how large an edit should be and when skills split or merge; for designing or operating a skill evolution pipeline", + "prerequisites": "A final-test partition kept outside edit selection and the incumbent skill retained for rollback; changing a skill's scope first needs explicit review of its identity and consumers", + "input_contract": "Execution trajectories or trace IDs with the diagnosed causal failure and the successful behavior an amendment must preserve; the incumbent skill and its revision lineage; held-out evaluation results for candidate edits", + "produced_artifact": "A scoped case or amendment proposal, or a consolidated candidate edit, with rejection records and the versioned revision lineage; a candidate for independently evaluated acceptance, not a replacement decision or an efficacy claim", + "failure_modes": [ + "An anecdote, or agreement among analysts, is taken as efficacy", + "Consolidation output is treated as a replacement decision instead of a candidate awaiting independent acceptance", + "A tie or uncertain result is reported as improvement", + "A conflict is resolved by voting for whichever outcome appeared more often in the pool", + "A rejection is applied to every future use of an idea instead of the comparison it constrains", + "Paper-specific section counts or length budgets are used as universal defaults, or a skill is split on length alone", + "A stronger task solver is assumed to be a stronger improver, or replay rankings and private inner scores are read as outer generalization" + ], + "refusal_point": "Records a conflict that conditioning cannot resolve, where the same context produces different outcomes across runs, as INCONCLUSIVE and flags it for human review instead of choosing a lesson; claims no universal minimum trace count, paper-to-code equivalence or local efficacy" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "atom": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "layer": "L3", + "source_span": { + "source_index": 0, + "path": "src/inferrsi/knowledge/data/skill_library/workflows/maintenance/skill-evolution-playbook/SKILL.md", + "byte_range": [ + 0, + 13082 + ], + "sha256": "f988a0569be93fec550da52484d22d970b0a6c31394ea463ad6ee40e0877ede6" + } + } + }, + "content": { + "guide.md": { + "path": "workflows/skill-evolution-playbook.md" + } + }, + "parts": { + "navigation": { + "skill_section": "navigation", + "layer": "L0", + "byte_range": [ + 0, + 409 + ], + "sha256": "2cdfb63f21cf1ea6060e06f9f09da75f5f4dea7ee06cf71a7f01f29751f1b658" + }, + "decision": { + "skill_section": "decision", + "layer": "L1", + "byte_range": [ + 0, + 4074 + ], + "sha256": "646c40f2c81f52b664edf678b60bbc340223daa5127540db15ee0dae6a60af06" + }, + "procedure": { + "skill_section": "procedure", + "layer": "L2", + "byte_range": [ + 4074, + 13082 + ], + "sha256": "9c508cb8a510cf055dc298d575f8a06be11fc1eac131e73f8d0a26b1ee46d2ce" + } + } +} diff --git a/src/inferrsi/knowledge/atoms/workflows/draft-acceptance-issue.md b/src/inferrsi/knowledge/atoms/workflows/draft-acceptance-issue.md new file mode 100644 index 000000000..874096066 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/draft-acceptance-issue.md @@ -0,0 +1,74 @@ +--- +name: draft-acceptance-issue +description: Draft a campaign acceptance issue with checklist, RunSpec, evidence paths, and placeholders for baseline/candidate SHAs. +metadata: + inferrsi: | + { + "schema_version": 1, + "profile": "local-skill-v1", + "kind": "skill", + "status": "candidate", + "origin": [ + "first-party" + ], + "consumption_mode": "packaged", + "tags": [ + "acceptance", + "issue", + "runspec", + "template", + "campaign" + ], + "empirical_validation": "not_run", + "applicability": { + "scope": "Opening a new acceptance campaign in an RSI-style repository, before any baseline or candidate run", + "prerequisites": "A chosen campaign subject and an empty evidence// tree copied from evidence/_template/; SHAs may still be placeholders", + "input_contract": "A campaign id of the form {model-or-scenario}/{device}x{count}, any user-supplied criteria or accepted plan, and available workload/baseline/calibration evidence for deriving missing targets", + "produced_artifact": "An acceptance issue body with campaign id, pinned baseline and candidate SHAs, RunSpec, criteria source and derivation including gaps and freeze authority, gates, evidence paths, initial verdict and a downstream citation blurb", + "failure_modes": [ + "Gates written after the search loop has already run", + "Campaign SHAs committed into recipes/, benchmarks/, skills or workflow defaults", + "PASS claimed without a validator/ freeze and a results/ rationale" + ], + "refusal_point": "Refuses to state a verdict other than INCONCLUSIVE while the validator freeze or results rationale is absent" + }, + "recommendations": [ + "Use user-supplied criteria; when absent, follow the performance-ceiling-analysis acceptance procedure to formulate targets, preserving partial requirements and identifying derived fields and evidence gaps.", + "Write the gates in plan/ before any search loop; a gate chosen afterwards cannot reject the candidate honestly.", + "Use the and placeholders until the campaign fixes them, and keep the real values in the issue.", + "Set the initial verdict to INCONCLUSIVE so the absence of evidence is recorded rather than assumed away." + ], + "limitations": [ + "Drafts an issue only; it freezes no gate and runs no measurement.", + "The placeholder SHA convention depends on the campaign owner filling them in later." + ], + "provenance_readsets": [], + "searchspace_not_applicable": "SKILL.md §§ Steps and Output prepare an acceptance issue, RunSpec, frozen gates and evidence paths; device identifiers are campaign metadata rather than a hardware-resource mechanism." + } +--- + +# Draft acceptance issue + +Use when starting a new campaign in a ThinkFlowLab RSI-style repo. + +## Steps + +1. Pick `campaign_id` (naming: `{model-or-scenario} / {device}×{count}`). +2. Copy `evidence/_template/` → `evidence//` (empty tree with README stubs). +3. Open issue using `.github/ISSUE_TEMPLATE/campaign-acceptance.yml` or [docs/contributing.md#acceptance-checklist](https://github.com/InferMatrixLab/InferRSI/blob/b2f60f913a949f9073686a23476f752e11d709a4/docs/contributing.md#acceptance-checklist). +4. Fill **pinned baseline SHA** and **pinned candidate SHA** in the issue—use placeholders `` / `` until known. +5. Resolve criteria using the [acceptance-criteria procedure](../../../playbooks/measurement/performance-ceiling-analysis/references/acceptance-criteria.md): + use user-supplied criteria; otherwise use `performance-ceiling-analysis` to + formulate targets. Preserve partial requirements, label derived fields and + retain unresolved evidence gaps. List supported gates and their provenance in + `plan/` before candidate search. +6. Set initial verdict `INCONCLUSIVE`. + +## Do not + +- Commit campaign SHAs into `recipes/`, `benchmarks/`, skills, or workflow defaults. +- Claim `PASS` without `validator/` freeze and `results/` rationale. + +## Output + +Issue body sections: campaign id, SHAs, RunSpec, criteria source and derivation (including evidence gaps and freeze authority), gates, evidence paths, verdict, downstream citation blurb. diff --git a/src/inferrsi/knowledge/atoms/workflows/repository-evolution-analysis.md b/src/inferrsi/knowledge/atoms/workflows/repository-evolution-analysis.md new file mode 100644 index 000000000..1ee25d8ae --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/repository-evolution-analysis.md @@ -0,0 +1,443 @@ +--- +name: repository-evolution-analysis +description: 'Analyze a repository''s commit history to build a capability-evolution model: what the system can do, how it got there, and what patterns allow it to iterate quickly. Use to produce history-derived knowledge for agent skill conditioning, and to design temporal-split benchmarks for skill evaluation. + + ' +metadata: + inferrsi: | + { + "schema_version": 1, + "status": "candidate", + "sources": [ + { + "url": "https://github.com/LearningToCommit/LearningToCommit", + "commit": "7e5a1d77", + "paths": [ + "data_construction/s1_scan_commits.py", + "data_construction/s3_tag.py", + "data_construction/s4_sample.py", + "data_construction/s5_build.py", + "modules/agent.py", + "modules/prompt_builder.py", + "modules/trajectory_to_md.py", + "system_prompts/solve_with_skill.txt", + "system_prompts/learn_reflect.txt", + "evaluation/pairwise_judge.py", + "evaluation/programmatic_metrics.py" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "77800032", + "paths": [ + "internal/", + "docs/" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "4b5d6d725fae3d8a263f6e43c707400e3765b84f", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go" + ], + "type": "git", + "revision_precision": "full" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "9848a9062a65c49e074c09770dc7de73dd012bea", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go", + "internal/library/rtk_path.go", + "internal/library/rtk_path_other.go", + "internal/library/rtk_path_windows.go", + "internal/library/rtk_path_test.go", + "internal/library/rtk_test.go", + "internal/library/rtk_upgrade_test.go", + "internal/library/library_test.go", + "internal/gui/library.go", + "internal/gui/assets/library.js", + "internal/gui/tests/library-rtk-path.test.cjs", + "library_cli.go", + "LICENSE" + ], + "type": "git", + "revision_precision": "full" + } + ], + "verification": { + "locally_verified": false, + "evidence_level": "source_grounded", + "note": "Carried LearningToCommit pipeline and Magpie history analysis, not causal evidence of development speed. The reviewed paper amendment is linked from SKILL.md; paper-to-code equivalence is not established. First-hand Magpie coordination research remains pending Dot delivery and owner review. The RTK worked transition is pinned static source/test inspection only; no upstream execution or heldout efficacy evaluation." + }, + "applicability": { + "scope": "any software repository with a recoverable git history", + "prerequisites": "git history access, optionally LearningToCommit-style benchmark for evaluation" + }, + "tags": [ + "repository-intelligence", + "history", + "skill-distillation", + "evaluation" + ], + "profile": "local-skill-v1", + "kind": "skill", + "origin": [ + "external" + ], + "empirical_validation": "not_run", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "The RTK transition is a learning example, not an independent heldout task; upstream tests were inspected, not executed.", + "Existing audit and synthetic KV comparison adapters are not a generic historical coding-task evaluator." + ], + "provenance_readsets": [], + "consumption_mode": "packaged", + "references": [ + "references/rtk-consumer-path-transition.md" + ] + } +--- + +# Repository Evolution Analysis + +Status: candidate. Procedures have not been evaluated against a real campaign. + +## When to use this skill + +Use this skill when you need to answer one of these questions before acting +on a repository: + +- What capabilities has this repository accumulated, and in what order? +- Why can this team iterate quickly, and what patterns should I preserve? +- What historical tasks can I construct for skill evaluation with a proper + temporal cutoff? +- Does this repository have a recurring convention for adding a new provider, + adapter, or capability class that I should follow? + +Do not use this skill to justify a specific code change — that requires +evidence from the current source. This skill produces history-derived +knowledge that conditions how you approach future changes. + +## Evidence to inspect first + +Before analysing history, determine what you have: + +1. Does `git log` work? (Full history vs. shallow clone — report the clone depth.) +2. What are the top-level directories and their activity counts? + `git log --numstat --format='%H' | grep -v '^$' | awk '{print $3}' | cut -d/ -f1 | sort | uniq -c | sort -rn | head -10` +3. What is the commit rate over time? A prepared JSONL extract is faster than + re-scanning — if one exists, use it. +4. Are there already extracted commit clusters, coupling indexes, or important- + commit shortlists? If so, read those first and validate by sampling diffs + rather than running a full re-scan. + +## Building the evolution model + +The model has three parts. Build them in order. + +### State model + +Identify what state the repository carries across commits: registered modules, +provider/adapter lists, config surfaces, routing tables. These are the nouns +that change. + +Method: look for `register`, `PROVIDERS`, `ADAPTERS`, `BACKENDS`, `ROUTES`, +`plugins`, `catalog` patterns in the most-active files. Count commits per +top-level directory as a proxy for where state lives. + +From the Magpie analysis (source-grounded, commit history 2026-09-22 to +2026-10-14, 3428 commits): +- State lives almost entirely in `internal/` (3280 commits = 95.7% of activity). +- Key state surfaces: provider registry, subscription manager, routing groups, + session index, library (MCP/skills/instructions), gateway config, usage ledger. +- `docs/` (152) and `site/` (83) are secondary; `.github/` (26) is CI-only. +Source: `magpie-change-coupling.json`, `magpie-commits.jsonl`. + +### Capability model + +Name the recurring capability families. A family is a cluster of commits that +add, repair, and extend one coherent user-facing capability. + +Method: start from existing clusters if available; validate each by sampling +2-3 diffs per cluster. For an unanalysed repository, use `git log --follow +--numstat -- ` on the most-active files, then group files by co-commit +frequency. + +From the Magpie analysis (source-grounded): + +| Family | Subsystem | Commits (approx) | Description | +|--------|-----------|-------------------|-------------| +| Provider onboarding | internal | ~300 | Adding a new AI provider/subscription | +| Subscription/auth | internal | ~200 | Sign-in flows, session tokens, metering | +| Routing & affinity | internal | ~150 | Routing groups, per-client affinity | +| GUI settings | internal | ~200 | Settings pages, UI state | +| Library/MCP | internal | ~180 | Skills, MCP servers, instructions sharing | +| Session search | internal | ~120 | Session index, search, folders | +| Usage/metering | internal | ~160 | Balance, usage charts, gateway keys | +| i18n | internal | ~120 | German, Japanese, Traditional Chinese | + +Source: `magpie-clusters.json`, validated by diff sampling on 8 SHAs from +`magpie-important-commits.md`. + +### Transition model + +For each family, reconstruct the actual commit sequence. The task description +proposes: initial feature → repair → edge-case → abstraction → compatibility +→ validation → cleanup. Do **not** assume this order. Infer it from real SHAs. + +From the Magpie analysis, the observed sequence for **provider onboarding**: + +1. `702477525a` (2026-09-24): Claude subscription as a provider; model lists + fetched, never compiled in. [initial feature] +2. `9bf6d43527` (2026-10-01): magpie no longer asks Anthropic for usage; adding + an account improved. [repair + edge-case] +3. `09c635cf03` (2026-09-25): model tells Pi/Crush/Codex how much it holds. + [capability extension, concurrent with step 2] +4. `4f22d103d3` (2026-09-27): Kiro served through its own API. [parallel provider + variant — abstraction follows feature] + +Observed sequence for **library/MCP centralization**: + +1. `dfc2d7fa93` (2026-09-25): MCP servers, skills, instructions kept once in + magpie, given to every agent. [initial abstraction — after several individual + agent-specific skills existed] +2. `bf0f3e3f73` (2026-10-03): a remote MCP server signed in once in magpie used + by every agent. [capability extension] +3. `9848a9062a` (2026-10-03): RTK says when it is missing and installs it. + [repair — self-healing environment] + +Source: `magpie-important-commits.md`, verified via `git show --stat` on each SHA. + +**Key observation:** In Magpie, abstraction layers are introduced *after* 2-5 +features exist that would share them, not speculatively upfront. This is +consistent across provider onboarding, library/MCP, and routing. Source: inferred +from commit date ordering; not causally established. + +## Historical Magpie observations and their limits + +These are carried history-analysis results from the earlier corpus, not a fresh +coordination audit. Commit granularity, repair intervals and subject patterns do +not causally establish speed, review latency, automation or release reliability. +The first-hand ownership/concurrency/review/testing/integration/release case is +pending Dot delivery and owner review; do not reconstruct it from these counts. + +**Evidence-grounded findings:** + +- **Change granularity**: 71% of commits under 1000 lines; p50 = 151 lines, + p75 = 342. Review speed and change safety were not measured. + Source: computed from `magpie-commits.jsonl` numstat. + +- **Repair latency**: median 1.54 hours from feature commit to related fix + (454 validated commit pairs). 42% of repairs land within 1 hour. + Source: computed from `magpie-commits.jsonl` date fields. + +- **Single-subsystem focus**: 91.3% of focused commits touch only one top-level + area. Provider, gateway, and GUI changes arrive in separate commits. + Source: computed from `magpie-commits.jsonl` top-3 paths. + +- **PR merge cadence**: ~40 PRs/day (from `(#NNNN)` patterns in subjects); + 27% of commits include a PR number. + Source: computed from `magpie-commits.jsonl` subjects. + +- **Abstraction timing**: shared layers introduced post-feature (observed for + library/MCP, provider registry, routing groups). Correlation with speed; + causation not established. + +**What this implies for an agent working on such a repository:** +When adding a new provider, adapter, or capability class, follow the existing +registration pattern — do not introduce a new abstraction unless 2+ concrete +implementations already exist. + +## Auditing a claimed capability + +When a release note or README claims a capability and you need to state whether +it runs at a given revision, use +[capability presence audit](references/capability-presence-audit.md). It classifies +each claim into implemented, hook, documented only or contradicted, and requires +the enabling gate for anything not implemented. This is narrower than the +capability model above: it answers presence and wiring, not speed. + +## Temporal-split benchmark construction (LearningToCommit method) + +Use historical tasks to separate earlier onboarding evidence from later test +changes. Keep three evidence classes distinct: the pinned public implementation +below, the paper's reported method/results, and proposed InferRSI safeguards. + +### Observed public implementation + +The following is a source inspection of +[LearningToCommit at `7e5a1d770eb9eb58e614db45f40b1b911529c6e7`](https://github.com/LearningToCommit/LearningToCommit/tree/7e5a1d770eb9eb58e614db45f40b1b911529c6e7), +not an executed benchmark or a claim of equivalence with every paper version. + +1. **Scan and split** + ([`s1_scan_commits.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/data_construction/s1_scan_commits.py), + [`utils.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/data_construction/utils.py)): + parse non-merge commit metadata/numstat, prefilter tiny or housekeeping + changes, sort retained commits by the recorded date, keep the most recent + requested count, then assign the oldest fraction to `learning` and the + remainder to `test`. An LLM suitability scan follows that split; unavailable + or oversized diffs are marked unsuitable. This stage, not S3, assigns the + chronological split. +2. **Derive categories** + ([`s2_cluster.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/data_construction/s2_cluster.py)): + ask a model to derive development categories from a sample of suitable + commits' suitability rationales. This is not direct file-coupling clustering. +3. **Tag categories** + ([`s3_tag.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/data_construction/s3_tag.py)): + classify each suitable commit using the categories, subject, rationale and + diff; retain the existing split. The tag is a category, not a cutoff date. +4. **Sample separately** + ([`s4_sample.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/data_construction/s4_sample.py)): + perform category-proportional sampling within the learning and test pools, + excluding unsuitable and uncategorized commits. This does not promise equal + category counts or coverage when the requested sample is too small. +5. **Build tasks** + ([`s5_build.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/data_construction/s5_build.py)): + export each sampled change's oracle diff and parent-revision source archive; + synthesize an issue-style query from subject, body and diff. The emitted + `benchmark_tasks.jsonl` top-level fields are: + ```text + id, repo, category, synthetic_query, oracle_diff, snapshot_path, + learning_commits + ``` + Each learning record contains `sha, repo, title, category, synthetic_query, + diff_path, snapshot_path`. Mode `all` shares all sampled learning commits + with each test task; `by_category` selects the matching category. No + `tier`, frozen `validator` or verification-command field is emitted here. + +**Snapshot and access boundary.** S5's helper uses `git archive` at the sampled +commit's parent. [`modules/sandbox.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/modules/sandbox.py) +extracts that archive and initializes a new Git repository with a base commit; +it does not give the agent the target repository's original history. These +inspected paths do not implement a `hidden_paths` filter or frozen external +validator. The phase directory is explicitly **not a security sandbox**: +agent tools run with host-user permissions. A parent snapshot alone does not +establish isolation from later source, oracle data or other host files. + +**Skill conditioning.** +[`workflow/phases.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/workflow/phases.py) +copies learned skill files into the phase's separate skills directory for the +with-skill solve; the baseline receives no skill directory. +[`modules/prompt_builder.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/modules/prompt_builder.py) +substitutes workspace/skills paths and describes that directory in the user +context. The [with-skill template](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/system_prompts/solve_with_skill.txt) +points to it; the environment context asks the agent to read `SKILL.md` first. +This is directory-based access, not verbatim insertion of the skill body. + +**Evaluation, not a correctness oracle.** + +- [`evaluation/programmatic_metrics.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/evaluation/programmatic_metrics.py) + computes changed-file IoU, tool-using assistant-message counts from the + trajectory, and signed/absolute line-count deviation from the oracle patch. + It does not run a frozen validator or map validator exit codes to task + correctness. +- [`evaluation/pairwise_judge.py`](https://github.com/LearningToCommit/LearningToCommit/blob/7e5a1d770eb9eb58e614db45f40b1b911529c6e7/evaluation/pairwise_judge.py) + compares the with-skill and baseline **patches**, shown with the task query + and oracle diff, on scope alignment, logic similarity, redundancy/hallucination + and code style. Its default four rounds use ABBA presentation order. It is + not an oracle-trajectory comparison or a fallback gated on ambiguous + programmatic results. Patch similarity and judge preference do not establish + functional correctness. + +### Paper claims and version boundary + +The [existing Learning to Commit paper ledger](../../maintenance/npu-skill-factory/references/papers-20261015/references/learning-to-commit.md) +records the v1 method, author-reported pilot outcomes and limitations. Those +paper claims are separate from the public-code observations above; this source +reconciliation does not reproduce them or establish paper-to-code equivalence. +Do not combine versions or promote this candidate on the basis of reported +localization, patch-size or judge outcomes. + +### Proposed InferRSI safeguards and portability questions + +These are adaptations to evaluate, **not mechanisms attributed to the pinned +upstream implementation**: + +- Freeze the learning inputs and skill revision before held-out evaluation; + audit synthetic-query answer leakage independently of the chronological split. +- Enforce source/oracle separation in an actually isolated, least-privilege + execution environment. If paths must be hidden, specify and verify that policy + rather than assuming that an archive or phase directory enforces it. +- Define and freeze task-specific correctness/integrity validators outside the + editable workspace, with explicit failure and incomplete-evidence handling. + Report correctness separately from localization, style, patch size and cost. +- For NPU/kernel tasks, first check whether commit context supports an intent-only + query and a reproducible parent environment. Compiler/runtime availability, + numerical checks, profiler access and performance-regression gates require + task-specific qualification; temporal sampling alone does not transfer them. +- Compare with-skill and baseline under declared matched model, harness, tool and + budget controls, retaining failed attempts and deviations. No kernel-repository + portability, agent-efficacy or performance result is established by this guide. + +## Scoped historical lessons + +For each lesson, record parent snapshot, task intent, accepted change, the agent's +specific discrepancy and the narrow applicability condition. Separate file-local +habits, subsystem invariants and repository-wide conventions. Accepted historical +code is a contrastive reference, not the unique correct solution or an eternal +rule. Revise or retire lessons when later accepted evidence contradicts them. + +Freeze adaptation inputs before future-task evaluation; audit issue synthesis and +source access independently. Report correctness, localization, patch size, style +and resource use separately. The +[Learning to Commit paper ledger](../../maintenance/npu-skill-factory/references/papers-20261015/references/learning-to-commit.md) +and [convention-expiry counterexample](../../maintenance/npu-skill-factory/references/papers-20261015/cases/methodology-counterexamples.md#e-c2--better-repository-familiarity-can-produce-unnecessary-caution) +extend the existing temporal-split method. These methodology papers do not verify +Magpie's actual development coordination or authorize another history scan. + +### Worked learning transition: RTK consumer PATH + +The [pinned RTK transition](references/rtk-consumer-path-transition.md) turns one +already-cited Magpie change into a conditional lesson: manager discovery and +hook enablement do not establish consumer name resolution. Read its +unknown-PATH, binary-identity, diagnostic side-effect and platform qualifications +before reuse. It is a learning example, not an independent heldout task; +upstream tests were inspected, not executed. Candidate/not_run is unchanged. + +## Constructing the capability evolution graph + +For a new repository, build the graph with this procedure: + +1. Run coupling analysis on the commit log to find co-changed file sets. +2. For the top 5-10 file clusters, trace the commit sequence on those files + with `git log --follow --numstat -- `. +3. For each cluster, read the first, largest, and most recent 2-3 commits. + Record for each: + ``` + intent: (what the commit message says it does) + subsystem: (top-level directory or component name) + before: (concrete: what was the state/API before this commit) + after: (concrete: what changed in behavior/interface) + files: (list of changed files) + validation: (were tests added? in the same commit or a later one?) + followups: (SHA of the next commit in the same family, if traceable) + rework: (was this commit later reverted or significantly amended?) + ``` +4. Connect nodes with edges only where a commit SHA directly establishes the + connection (not where you infer it from timing alone). + +INCONCLUSIVE: if the repository history has gaps (shallow clone, squash merges, +or missing files), report which capability families cannot be reconstructed and +why. + +## What this skill does not do + +- It does not analyse the current source to determine correctness. +- It does not produce a performance measurement. +- It does not decide whether a proposed change is safe to make. +- It does not automatically select which tasks to include in a benchmark. + +All of those require separate evidence. diff --git a/src/inferrsi/knowledge/atoms/workflows/repository-evolution-analysis/references/capability-presence-audit.md b/src/inferrsi/knowledge/atoms/workflows/repository-evolution-analysis/references/capability-presence-audit.md new file mode 100644 index 000000000..ebd0c9c62 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/repository-evolution-analysis/references/capability-presence-audit.md @@ -0,0 +1,72 @@ +# Capability presence audit + +A procedure for answering one narrow question: **does the claimed capability actually run at this revision, and through what gate?** It is narrower than a capability-family analysis and wider than reading a README. + +Use this reference when a release note, README or vendor document lists features and you must state what the code does. Do not use it for performance claims — this classifies presence and wiring, not speed. + +## The four buckets + +Every claim lands in exactly one: + +| Bucket | Test | Typical evidence | +|---|---|---| +| **Implemented** | A reachable call path from the public entrypoint changes behaviour | A caller that is not gated off, plus a body that is not empty | +| **Hook** | A symbol exists and is called, but its body is empty, or its caller is gated off by a value that never occurs | Empty virtual method with no subclass; a body behind a constant-false gate | +| **Documented only** | No symbol, or symbols only in tests and docs | A tree-wide search that returns nothing in the called graph | +| **Contradicted** | The code does something different from the claim | A default that inverts the claim; a backend that asserts instead of degrading | + +A claim that fits two buckets is under-specified. Split it before classifying: "asynchronous scheduling is enabled by default" is two claims, one about existence and one about the default. + +## Procedure + +1. **Record the claim verbatim.** Do not paraphrase into something easier to confirm. Note whether it is a feature list, a hardware list, or an exclusion list. Exclusion lists are the easiest to audit and the most informative: a README that says "does not ship X" is making a falsifiable claim. + +2. **Find the entrypoint that would exercise the claim.** Follow from the public entry, not from the directory that shares the claim's name. Name-adjacency is the most common false positive. + +3. **Classify.** Use the table above. + +4. **For every hook, find the gate.** Ask what would have to be true for the body to run, then check whether that condition can be true in this build. An empty virtual method plus no subclass is a hook. A real body behind a flag whose value is a constant is also a hook. A flag that defaults false is *not* a hook if the documentation says it is optional. + +5. **Check for subclasses and registries.** A base class with virtual methods proves nothing. Search for derived types and for registration. Record the command shape, because "no subclass found" is a claim about a search. + +6. **Check defaults, not just existence.** A feature can be present and inert. Read the environment-variable or configuration default and quote it. Then check whether some other construction path overrides it — a `setdefault` in a dataclass `__post_init__` can make a variable default-false in one sense and default-true in another. + +7. **Separate the four claim strengths.** Exists, is correct, is fast, is end-to-end usable. Never let one imply another. + +8. **State the extraction boundary.** Say explicitly whether the tree is complete. Only a complete tree lets "absent" mean absent; a sparse checkout licenses only "not located in the inspected paths". + +## Worked instance + +Applied to [deepseek-ai/DeepInfer @ 8b16149741a4935e1dec8cea27853f273b374c5b](https://github.com/deepseek-ai/DeepInfer/tree/8b16149741a4935e1dec8cea27853f273b374c5b), by static source reading only. The supplied source-reading archive includes the parent and six direct vendor snapshots, but omits nine listed media files and leaves ten nested vendor gitlinks unexpanded. Its untruncated upstream tree inventory describes the snapshot before those omissions; it does not make the delivered archive a complete checkout or build environment. The observations below are bounded to the named parent-source paths, not an absence proof over omitted or external code. + +| Claim (verbatim from README) | Bucket | Deciding evidence | +|---|---|---| +| "Asynchronous scheduling (zero-overhead batch scheduler)" / "Enabled by default." | **Implemented**; constructor-dependent default | [The worker defers decode post-processing](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/worker/worker.py#L182-L187). [EngineArgs uses setdefault and rearms the variable](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/engine/arg_utils.py#L48-L55), with [NORMAL/COMPLETION true and PROMPT false](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/engine/engine_type.py#L15-L17). The standalone [EnvVar.bool default is false](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/environ.py#L69-L71). These construction contexts are not contradictory; an explicit environment value is preserved. | +| "Parallelism: Attention DP / balanced CP, MoE EP + EPLB" — the EPLB rearrangement part | **Implemented**, opt-in; not a Hook | [Model sampling calls the EPLB manager](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/model_executor/models/deepseek.py#L402-L409), which [calls each balancer](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/model_executor/eplb/__init__.py#L378-L384). Its [real update/rearrange path](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/model_executor/eplb/__init__.py#L131-L165) returns when the interval is zero and skips EP size one. The [interval defaults to zero](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/environ.py#L111-L117), using the [integer default](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/environ.py#L62-L63). This disables dynamic rearrangement by default, not the implementation or all load statistics. | +| "A KV cache system" — under the README's complete-service exclusion heading | Service save-integration **Hook**; in-engine KV **Implemented** | [README:38-42](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/README.md#L38-L42) excludes components needed for a complete service. The inspected [save-integration methods have no implementation](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/engine/llm_engine.py#L815-L822); this does not mean device KV is missing: [CacheEngine allocates KV/state storage and constructs GPUCacheInterface](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/worker/cache_engine.py#L918-L966). | +| "VE/Prefill/Decode disaggregation (most required engine functionality is already implemented)" — the same service exclusion list | **Hook** at the inspected integration seam | [init_pd_split](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/engine/llm_engine.py#L800-L809), [send_processed_prompts and post_process_model_outputs](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/engine/llm_engine.py#L848-L858) have no implementation in the base engine. The bounded parent-source search described below located no subclass; this does not negate the README's statement that supporting engine functionality exists. | +| "Load balancing across data-parallel replicas for both prefill and decode" — the same service exclusion list | **Documented only** within this readset | [README:38-42](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/README.md#L38-L42) states the service exclusion. This bounded hook/default audit did not establish an application request router or audit omitted/external implementations; it makes no stronger absence claim. | + +Two subtleties the exercise surfaced: + +- **`finalize_seq` is not empty.** It is inside the same virtual block but [calls scheduler.free_seq](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/engine/llm_engine.py#L804-L806). So the hook block is heterogeneous: an implementation inheriting it would get partial behaviour rather than nothing. A blanket "all these are empty" statement would be wrong. +- **A body can exist behind an inactive base-class gate.** [do_copy_state](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/engine/llm_engine.py#L787-L798) performs a copy only when its buffer exists, while [should_copy_state returns False](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/engine/llm_engine.py#L811-L813) in the inspected base engine. Body-present alone is not evidence that this entrypoint executes it. + +## Pitfalls + +- **Name-adjacency.** A directory or class named after the feature is not evidence that the feature runs. In the audited source, three claimed-absent components were present as named empty methods — the name was *more* misleading than absence would have been. +- **Body-present-is-not-reachable.** See the state-copy case above. +- **Flag defaults.** EPLB dynamic rearrangement is opt-in, whereas ZOS is enabled by the standard NORMAL/COMPLETION EngineArgs constructor when no environment override exists. Reading the variable's standalone default alone gives the wrong answer for that entrypoint. +- **Hardware lists.** A supported-device list is not a compatibility guarantee. Check whether unsupported cases assert or degrade silently; in the audited source one property hard-asserted on the non-NVIDIA backend. +- **Documentation that describes the deployment, not the code.** A production Q&A can truthfully describe a shape the open release does not implement. Label it DOC and keep it separate from CODE findings — both statements can be true. +- **Comments as evidence, carefully.** A source comment saying "virtual method, handles finished requests" is the author's description, not the behaviour. Read the body. The same applies in reverse: a comment stating a correctness requirement (as `mtp_varlen.hpp:160` does) is evidence of intent that must then be checked against the code that follows it. +- **Sparse checkouts.** Absence in a curated skill-doc checkout proves nothing. Say so rather than reporting a feature as missing. + +## Output + +A table with one row per claim: claim verbatim, bucket, deciding evidence, the gate that would enable it, residual uncertainty. Then a short list of findings that change how the release may be described. + +## Evidence this instance produced + +- The full-SHA path/line links above distinguish feature code, constructor defaults and the complete-service exclusion list; none is native execution evidence. +- Bounded search: `rg --no-ignore -n -F LLMEngine deepinfer tests`, plus class-declaration inspection, at the stated pin. The located declaration is [llm_engine.py:130](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/engine/llm_engine.py#L130); the public entry [constructs that engine through EngineArgs](https://github.com/deepseek-ai/DeepInfer/blob/8b16149741a4935e1dec8cea27853f273b374c5b/deepinfer/entrypoints/llm.py#L77-L84). No subclass was located in those two inspected directories. Vendors, unexpanded gitlinks and external deployment code are outside this search. diff --git a/src/inferrsi/knowledge/atoms/workflows/repository-evolution-analysis/references/rtk-consumer-path-transition.md b/src/inferrsi/knowledge/atoms/workflows/repository-evolution-analysis/references/rtk-consumer-path-transition.md new file mode 100644 index 000000000..0763a2732 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/repository-evolution-analysis/references/rtk-consumer-path-transition.md @@ -0,0 +1,156 @@ +# Worked transition: manager discovery is not consumer reachability + +Status: source-derived **candidate**; empirical validation **not_run**. This is +one learning example inside repository-evolution-analysis, not a new skill, +benchmark task or independent heldout task. It does not establish automatic +learning, agent efficacy or Magpie's development speed. + +## Source boundary + +The inspected change is +[`9848a9062a65c49e074c09770dc7de73dd012bea`](https://github.com/yetone/magpie/commit/9848a9062a65c49e074c09770dc7de73dd012bea), +whose recorded parent is +[`4b5d6d725fae3d8a263f6e43c707400e3765b84f`](https://github.com/yetone/magpie/tree/4b5d6d725fae3d8a263f6e43c707400e3765b84f). +Public source was inspected on 2026-10-29; upstream programs, shell profiles, +installers, Go tests and browser tests were **not executed** for this example. +The commit's reported checks are author reports, not local receipts. + +| Readset | Parent evidence | Change evidence and purpose | +| --- | --- | --- | +| Discovery and diagnostic view | [`internal/library/rtk.go`](https://github.com/yetone/magpie/blob/4b5d6d725fae3d8a263f6e43c707400e3765b84f/internal/library/rtk.go) | [`rtk.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/library/rtk.go): `rtkPath`, `ReadRTK`, hook-state detection | +| PATH observation and mutation | These PATH-specific files are added by the change, absent in its parent | [`rtk_path.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/library/rtk_path.go), [`rtk_path_other.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/library/rtk_path_other.go), [`rtk_path_windows.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/library/rtk_path_windows.go) | +| PATH supplied to the observer | [`proc/path_other.go`](https://github.com/yetone/magpie/blob/4b5d6d725fae3d8a263f6e43c707400e3765b84f/internal/proc/path_other.go), [`proc/path_windows.go`](https://github.com/yetone/magpie/blob/4b5d6d725fae3d8a263f6e43c707400e3765b84f/internal/proc/path_windows.go), [`provider/install_windows.go`](https://github.com/yetone/magpie/blob/4b5d6d725fae3d8a263f6e43c707400e3765b84f/internal/provider/install_windows.go) | [`proc/path_other.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/proc/path_other.go), [`proc/path_windows.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/proc/path_windows.go), [`provider/install_windows.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/provider/install_windows.go): `LoginPath` and reuse of the moved registry reader | +| Upgrade destination | [`rtk_upgrade.go`](https://github.com/yetone/magpie/blob/4b5d6d725fae3d8a263f6e43c707400e3765b84f/internal/library/rtk_upgrade.go) | [`rtk_upgrade.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/library/rtk_upgrade.go): symlink-aware script destination | +| Entry points and presentation | Changed caller hunks in the pinned commit | [`internal/gui/library.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/gui/library.go), [`internal/gui/assets/library.js`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/gui/assets/library.js), [`library_cli.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/library_cli.go): warning, explicit repair action and restart advice | + +This is a bounded readset, not a complete consumer/runtime audit. In particular, +the change's description of Pi's extension is a reported motivation; the +extension's independent upstream implementation was not inspected here. + +## Reconstruct the transition + +**Task intent (commit report).** An agent could fail to find RTK by name although +Magpie found an installation and showed its hook enabled. The requested repair +was to expose that mismatch and offer an explicit PATH action, not silently +rewrite shell profiles or reinstall every agent. + +**Before (inspected parent).** `rtkPath` first used Magpie's `exec.LookPath`, then +searched installer locations outside that PATH. `ReadRTK` exposed the discovered +path, version, gains and per-agent hook state. These facts did not answer whether +a separately launched agent could resolve the name `rtk`. On non-Windows, +`proc.UserPath` augmented Magpie's own environment with known installer folders +and login-shell entries. Thus the manager's search environment could be broader +than the consumer's. The parent view had no `OffPath` distinction. + +**After (inspected change).** Discovery is retained, with Windows WinGet package +folders added. A separate `rtkReached` examines `proc.LoginPath`, and `ReadRTK` +adds `OffPath`, `PathDir` and `PathLink` when that check reports no match. The GUI +shows the warning whenever `OffPath` is true, but offers the repair button only +when a destination is available; the CLI also describes the applicable action. +`PathRTK` is reached by the explicit GUI +POST `/api/library/rtk/path` or CLI `magpie library rtk path`. It attempts the +platform-specific change, rereads the diagnostic view, rejects a still-off-PATH +result and lists enabled agents for restart. It does not restart those processes. + +**Observed discrepancy, not a reconstructed agent failure.** The contrast is +between manager-side discovery/hook state and consumer-side name resolution. +No original coding-agent trajectory or independent agent patch is available in +this readset, so do not invent what an agent tried or why it made a mistake. + +## Conditions and counter-signals + +| Condition | What the pinned implementation establishes | What it does not establish | +| --- | --- | --- | +| Manager found a path | `rtkPath` found a manager-PATH match or an existing fallback path | Successful execution, consumer name resolution or matching consumer binary; fallback `exists` is only a stat check | +| Known consumer PATH, no runnable name | `rtkReached` found no non-directory `rtk`/`rtk.exe` in its nonempty entries; non-Windows also requires an execute bit | Exhaustive emulation of every shell's aliases, wrappers, launch environment or executable-resolution rules | +| Unknown consumer PATH | A nil `LoginPath` makes `rtkReached` return **true**, suppressing the warning | Confirmed reachability; absence of `OffPath` can mean unknown rather than success | +| Runnable same-name file found | The name/existence/mode predicate passed somewhere in the observed directories | Identity with `ReadRTK.Path`, matching version, first-resolved binary, integrity, hook compatibility or a successful launch; Windows does not apply a Unix execute-bit test | +| PATH repaired | The code rereads the view and gives restart advice | Changed environments of already-running agents/terminals or actual end-to-end RTK use | + +Non-Windows `LoginPath` invokes the login shell interactively and caches a +successful PATH for a minute. Windows instead reads machine then user registry +PATH values, expanding variables and skipping unreadable keys. Neither is a +receipt from a specific agent process; caching, partial registry reads and +different launchers can weaken the approximation. A nil result is distinct from +a non-nil empty list in `rtkReached`. + +### Mutation and diagnostic boundaries + +- **Non-Windows repair:** select the first eligible directory from the fixed + list of local-bin, user-bin, Homebrew, system-local-bin, Linuxbrew and Cargo + locations. It must already occur in the observed PATH, be an existing writable + directory and have no existing `rtk` entry under `Lstat`. Create a symlink to + the discovered binary; do not overwrite an occupied entry or edit a profile. + If no destination qualifies, return advice rather than invent another folder. +- **Windows repair:** use the binary's own directory, append it to the user's + registry PATH if absent under the implemented case/trailing-separator check, + update Magpie's process PATH and broadcast an environment-change notification. + This is not the non-Windows symlink mechanism and not a copy of the binary. +- **Upgrade follow-through:** the non-Windows script-upgrade branch resolves a + symlink's target directory rather than installing over the link. Existing + package-manager branches remain separate; reading the proposed command does + not execute an upgrade or prove installer classification for every layout. +- **Diagnostics are not pure read-only:** with a discovered binary, `ReadRTK` + executes `--version` and `gain --daily --format json`. On the non-Windows + off-PATH branch, selecting `PathDir` may create, close and attempt to remove a + temporary file to probe writability; cleanup errors are not checked. PATH + observation may execute login-shell profiles. Do not call this a harmless + filesystem read or guarantee that an arbitrary discovered executable has no + side effects. `ReadRTK` does not itself perform the explicit PATH repair. +- **Caller effects are separate:** the GUI GET handler can call `RTKLatest`, + and the CLI calls `CheckLatest`; those paths may query GitHub. A read-labelled + UI/CLI operation therefore is not an offline/no-execution guarantee either. + +## Tests inspected, not executed + +| Source at the change pin | Assertions inspected | Limit | +| --- | --- | --- | +| [`rtk_path_test.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/library/rtk_path_test.go), `TestRTKOffPath` | Fallback discovery outside PATH; no destination produces advice; an eligible user-bin destination produces a symlink and enabled-agent restart list; script-upgrade destination follows that link | `!windows`; fake RTK and test PATH, not a real agent/installer | +| [`library_test.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/library/library_test.go), sandbox helper; [`rtk_test.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/library/rtk_test.go) | Sandbox replaces `userPath` with the test's PATH; fake RTK supplies version/gain/install behavior | Does not exercise real login-shell discovery; fake output is not observed savings | +| [`rtk_upgrade_test.go`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/library/rtk_upgrade_test.go) | Fake Brew/script upgrades and a local fake latest-release server | Not real package-manager or Windows validation | +| [`library-rtk-path.test.cjs`](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/internal/gui/tests/library-rtk-path.test.cjs) | English/Chinese warning, enabled-agent tag, button POST, warning removal and restart message in Chromium/WebKit cases | API is mocked; does not run backend PATH mutation or an agent | + +The inspected regression does not test unknown-PATH semantics, same-name binary +identity or Windows registry execution. This table describes test source, not a +passing test result. No upstream runtime or cross-platform qualification follows. + +## Conditional lesson to reuse + +When a manager configures a consumer with an absolute executable path but the +consumer's hooks later invoke it by name, **separate installation discovery, +hook enablement, consumer resolution and actual execution**. Inspect the actual +caller and environment at the target revision before reusing this lesson. + +1. Identify the command shape and who resolves it. Record the manager's found + path separately from the consumer environment; keep unknown observations + unknown rather than upgrading a warning's absence to success. +2. Check name collisions and version/identity requirements separately. The + historical predicate is evidence of its implementation, not a universal + identity validator or a recommendation to fail open. +3. Before offering repair, identify authorized mutations, occupied destinations, + platform behavior, upgrade destination and process-restart requirements. + Classify diagnostic execution/probes separately from the explicit repair. +4. Use discriminating tests for the mismatch and the chosen mutation. Add + unknown/identity/launcher/platform cases only under a separately accepted + implementation scope; source inspection alone does not close those gaps. + +This lesson is narrow: it does not apply unchanged when the consumer always +uses an absolute path, inherits a different verified environment or has another +resolver. The accepted historical patch is one contrastive solution, not the +unique correct repair or an enduring repository-wide convention. + +## Evaluation and rights limits + +The target diff and regression tests are learning inputs here. Reusing this +same transition as a heldout task would leak the answer; future efficacy work +needs independently separated tasks, frozen controls and correctness evidence. +InferRSI's existing `audit` and `kv-admission-diagnostic-v1` comparison adapters +handle report auditing/extraction and synthetic KV diagnosis respectively; they +do **not** provide a generic historical coding-task evaluator. Packaging and +Reader checks verify access/consistency, not this lesson's effect on agents. + +This reference is an attributed interpretation of yetone/magpie, not a vendored +source snapshot. Its pinned [root LICENSE](https://github.com/yetone/magpie/blob/9848a9062a65c49e074c09770dc7de73dd012bea/LICENSE) +declares MIT; no substantial upstream code is reproduced here. That observation +does not resolve rights for other inherited sources, grant third-party/model +rights or alter existing unknown/absent license declarations in this skill. diff --git a/src/inferrsi/knowledge/atoms/workflows/rsi-evidence.md b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence.md new file mode 100644 index 000000000..558fca4e8 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence.md @@ -0,0 +1,154 @@ +--- +name: rsi-evidence +description: Guide agents to establish acceptance criteria, freeze and cite RSI evidence using plan/results/patch/validator paths and PASS/FAIL/INCONCLUSIVE verdicts. +metadata: + inferrsi: | + { + "schema_version": 1, + "profile": "local-skill-v1", + "kind": "skill", + "status": "candidate", + "origin": [ + "first-party" + ], + "consumption_mode": "packaged", + "tags": [ + "evidence", + "verdict", + "runspec", + "provenance", + "review" + ], + "empirical_validation": "not_run", + "provenance_readsets": [ + "references/loopx-goal-governance/README.md" + ], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "recommendations": [ + "Use user-supplied acceptance criteria; otherwise follow performance-ceiling-analysis to formulate targets. Preserve partial requirements and record each derived field's evidence before freezing gates.", + "Link evidence paths in the report; a metric quoted only in a comment cannot be re-checked later.", + "Fingerprint tracked source even when the output directory overlaps it, and exclude only the current run's generated files.", + "Treat a missing upstream-cache release proof as INCONCLUSIVE rather than a PASS with a caveat.", + "Read baseline and candidate SHAs from the acceptance issue for that campaign, never from a skill default.", + "Freeze optional required_trial_checks for complete requests, effective graph controls and clean worker exits; require literal true per trial and retain supporting receipts." + ], + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation." + ] + } +--- + +# RSI evidence discipline + +Use when documenting or reviewing optimization campaigns in ThinkFlowLab-style repos. + +## Establish acceptance criteria + +Use the user's supplied criteria, including a referenced accepted plan. If none +were supplied, use `performance-ceiling-analysis` to formulate evidence-backed +targets under its [acceptance-criteria procedure](../../../playbooks/measurement/performance-ceiling-analysis/references/acceptance-criteria.md). +Preserve partial requirements and derive only missing fields. Record the source +of each criterion, derivation evidence and freeze authority before search. +Unknown inputs remain explicit; estimates cannot relax supplied or frozen gates. + +## Evidence paths + +For campaign id `{campaign_id}`, artifacts live under: + +- `evidence/{campaign_id}/plan/` +- `evidence/{campaign_id}/results/` +- `evidence/{campaign_id}/patch/` +- `evidence/{campaign_id}/validator/` + +Do not paste metrics only in issue comments—link paths. + +## Verdicts + +Only **`PASS`**, **`FAIL`**, or **`INCONCLUSIVE`**. + +- **PASS**: pinned baseline SHA + pinned candidate SHA, frozen validators, gates met on recorded RunSpec. +- **FAIL**: gates not met with complete evidence. +- **INCONCLUSIVE**: missing freeze, partial runs, or environment blocks comparison. + +## SHAs + +Baseline and candidate revisions are **owned by the acceptance issue** for that campaign. Replace placeholders like `` and `` from the issue—never assume org-wide default pins in skills or CI. + +## RunSpec + +Freeze **repo × revision × backend × device × model × scenario** before comparing results. Reference `inferrsi.runspec.RunSpec` or your renamed package. + +## Runtime and upstream review gates + +- Keep framework dispatch and its tests model-neutral. Prefer existing explicit + configuration over a second model/device/version-specific selection rule. + Model policy belongs in model adapters; backend prerequisites and topology + constraints belong in the owning backend. Remove obsolete knobs and tests + when consolidating selection, while retaining default and explicit-opt-in checks. +- Before changing a shared component or script, enumerate direct and transitive + consumers and map each changed contract to a regression test. Exercise the + other consumers' fast and fallback paths, layouts, dtypes, hooks and gradients; + include encoder/decoder integration where applicable. Record commands, source, + environment, failures and skips. Missing consumer coverage is `INCONCLUSIVE`; + one model's E2E success does not establish another model's quality or speed. +- Hardware/dtype matches do not prove build dependencies or collective availability. + Keep optional acceleration opt-in until initialization establishes prerequisites; + do not fall back on only one rank after starting a collective. +- Prove that request caches release after success, failure, interruption and + dropped step-mode requests. Avoid strong references from singleton models to + request prefix KV. Preserve reusable graph buffers separately. +- Search the target repository for shared primitives before adding kernels. + Place reusable math in its common operator layer, keep model-specific policy + in the adapter, and qualify reduction order, casts, hooks and dtype fallbacks. +- Fingerprint tracked source even when output directories overlap source. + Exclude only the current run's generated untracked artifacts. +- Require outputs to resolve inside their own trial directory. Reject aliases to + references, repeated paths within a trial, and reused outputs across trials. +- Cleanup and integrity probe failures must still produce a failed manifest; + missing evidence or changed source must never become `PASS`. +- Publish portable reproduction commands and path-normalized evidence with + checksums. Keep the archived raw records immutable and distinguish historical + frozen claims from fresh comparisons on rebased code. + +## Downstream citation + +External PRs link the acceptance issue and SHAs; they do not redefine thresholds. Mark summaries **unverified** if artifacts are missing. + +## Goal authority and accounting decisions + +When a recommendation, stop/resume decision or repeated settlement depends on +source state, use the [LoopX Goal governance reference](references/loopx-goal-governance/README.md). +It separates canonical Todo authority from Markdown/index projections, Python +fact preparation from TypeScript decisions, and local accounting recovery from +external execution guarantees. Read its counterexamples before interpreting +`should_run`, missing state or a replay lookup. This source-derived candidate +adds no execution permission or empirical validation; the evidence, RunSpec and +verdict rules above still apply. + +## Omni and streaming experiments + +Use the [Omni experiment contract](references/omni-experiments.md) +for reference/RNG parity, feedback-aware stage boundaries, +matching streaming decode schedules, internal graph controls and protocol preflight. +Freeze selected `--require-trial-check` dotted boolean fields +in RunSpec and require literal true evidence from every baseline/candidate trial. +Missing, malformed or false fields make qualification INCONCLUSIVE; a successful +process and metric alone do not prove complete requests or normal worker exits. +Retain underlying receipts and all failed attempts. After repairing the harness, +rerun the complete comparison rather than combining arms from different attempts. +These checks do not replace the accuracy dataset or mixed-request concurrency. diff --git a/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/LICENSE b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/LICENSE-MIT.md b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/LICENSE-MIT.md new file mode 100644 index 000000000..f5746a7ee --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/LICENSE-MIT.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 LoopX contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/NOTICE.md b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/NOTICE.md new file mode 100644 index 000000000..45a3556ec --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/NOTICE.md @@ -0,0 +1,9 @@ +LoopX +Copyright 2026 LoopX contributors + +LoopX was created by huangruiteng (https://github.com/huangruiteng), +with contributions from the LoopX community. + +LoopX releases through v0.4.7 were distributed under the MIT License. +The historical MIT license text and copyright notice are retained in +LICENSE-MIT. diff --git a/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/README.md b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/README.md new file mode 100644 index 000000000..30a79f0ff --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/README.md @@ -0,0 +1,77 @@ +# LoopX Goal authority and quota boundaries + +Use this source-derived candidate when reviewing an agent's proposed next action, +a stopped Goal, or a repeated quota settlement. It supplies questions and +counterexamples for the existing RSI evidence workflow; it does not implement a +controller or change InferRSI's RunSpec, authorization or verdict rules. + +The source is [LoopX at `f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9`](https://github.com/loopx-project/loopx/tree/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9), +inspected on 2026-10-26. [The ledger](source-ledger.json) records actual file +bytes, Git blob identities, inspected sections and exclusions. Code, document +intent, test assertions and deductions have separate meanings. Upstream tests +were read, not run; empirical validation is `not_run` and agent efficacy is not +evaluated. + +## Choose the question + +| Question | Read | Observation to retain | +| --- | --- | --- | +| Is this the current Todo authority or a readable view? | [Authority and projections](mechanisms.md#authority-and-projections) | Selected provider, revision, complete source availability and Goal identity | +| Does `should_run` permit delivery, repair or another bounded action? | [Decision ownership and order](mechanisms.md#decision-ownership-and-order) | Admission lanes, effective action, reason and the guard that changed them | +| Is a retry the same accounting effect? | [Accounting identity and recovery](mechanisms.md#accounting-identity-and-recovery) | Effect ID, semantic request digest, index basis and durable receipt | +| Can an old event file or a missing receipt be treated as empty? | [Retirement and external effects](mechanisms.md#retirement-and-external-effects) | Explicit refusal or uncertainty; preserve the source and recovery evidence | +| What would expose an incorrect interpretation? | [Decision cases](decision-cases.md) | Source-supported expected result and the tempting unsupported conclusion | + +```mermaid +flowchart TB + A["Selected canonical Todo provider\nsource authority + revision"] --> P["Python: collect source facts\nhealth, frontier and scope"] + P --> T["TypeScript: ordered run decision\naction + distinct admission lanes"] + T --> C["Separate TypeScript accounting transaction\neffect ID + request digest + receipt"] + A -. "readable projection" .-> D["Markdown / Todo index / status"] + C --> F["Local JSON + Markdown + run index"] +``` + +The diagram shows inspected responsibilities, not an atomic transaction across +these layers. A returned decision does not execute work. Accounting artifacts +do not fence an external host or provider effect. + +## Apply the knowledge + +1. Identify the source revision and affected Goal. If an exact `GoalRef` is + required, retain both the Goal ID and its instance ID. +2. Establish source availability before interpreting counts or recommendations. + Distinguish missing state, unavailable provider and valid empty state. +3. Read the action and all admission lanes together. Check the ordered guards + before treating a repair or inbox action as normal delivery permission. +4. For accounting recovery, distinguish repeating the original commit from a + replay lookup. Compare identity and request semantics before retrying. +5. Record the remaining uncertainty and the next authorized check. Keep + execution status, task acceptance and `PASS` / `FAIL` / `INCONCLUSIVE` + separate. + +The examples are review aids, not permission to execute LoopX, restore a Goal, +remove files or spend compute. The historical reference for InferRSI RFC #137 +remains `a6f28057b49fe03bb234fa6ce1bac5d61df0c58f`; this newer knowledge readset +does not replace that pin or deliver its checkpoint implementation. + +## Read through InferRSI + +With the optional `skills` parser installed: + +```bash +inferrsi skills resource rsi-evidence references/loopx-goal-governance/mechanisms.md +inferrsi skills reference optimization-search-policy ../../workflows/governance/rsi-evidence/references/loopx-goal-governance/README.md +``` + +The generated catalog's `inferrsi.common.skills.rsi_evidence` record links the +complete owner, including these resources. Reading, indexing or packaging the +material does not establish LoopX runtime behavior or incremental skill benefit. + +## License and attribution + +The pinned source uses Apache-2.0. Preserve its original [LICENSE](LICENSE) +and [NOTICE](NOTICE.md). The notice credits LoopX contributors and its creator +huangruiteng, and records MIT distribution through v0.4.7; the retained +[historical MIT text](LICENSE-MIT.md) does not relicense current code. +These references paraphrase the inspected mechanisms; no LoopX runtime is +bundled and no enterprise affiliation is inferred. diff --git a/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/decision-cases.md b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/decision-cases.md new file mode 100644 index 000000000..706b1c62a --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/decision-cases.md @@ -0,0 +1,61 @@ +# Decision cases + +These are source-supported review cases for the [mechanisms](mechanisms.md). +They are not recorded executions. `not_run` applies to runtime and agent +evaluation. Inputs below describe the relevant facts; they are not complete +LoopX API requests or authorization to run work. + +## Goal and next-action cases + +| Case | Relevant input or observation | Expected interpretation / next check | Unsupported conclusion | +| --- | --- | --- | --- | +| G1: missing active state | The selected Goal has `state_file_missing`; an old recommendation and unused quota remain visible | Goal health is false. Inspect reconnect/retire guidance; do not manufacture intent, acceptance or stop conditions from the recommendation | Budget availability makes this a runnable Goal | +| G2: display versus authority | Markdown says a Todo is open; the selected provider is unavailable | Retain an authority failure, not a valid empty or Markdown-backed work list. Restore/inspect the owning provider through an authorized recovery | Readable Markdown is sufficient fallback authority | +| G3: valid empty source | Canonical read is loaded and complete, with zero Todos | Empty source is real input. Separately inspect closure/frontier evidence before terminal classification | Empty display or zero count proves terminal completion | +| G4: budget and recovery | No execution lane is open and state is `throttled`; compare with a separately admitted recovery lane | Closed throttled case skips. An explicitly admitted recovery can select `outcome_floor_recovery`; inspect its own boundary | A recovery action permits arbitrary delivery or enforces a supplier cost cap | +| G5: capability and workspace | Capability requests `repair_bridge`, and workspace guard is present; no later inbox/terminal override | Normal/recovery delivery and capability repair are closed; workspace repair is the selected action. `should_run=true` is repair permission at this layer | `should_run=true` permits the original selected Todo | +| G6: inbox exception | Required prompt upgrade plus due reply; compare nonterminal facts with terminal-source inbox facts | Nonterminal upgrade blocks. Terminal-source inbox exception preserves the reply action. Read source conditions rather than applying a universal priority slogan | Inbox always wins, or terminal always closes every possible lane | +| G7: terminal and resume | Complete user/agent Todo sources and validated empty frontier derive terminal-no-follow-up, with no inbox priority | All execution lanes close and recurring automation stops until explicit resume. Missing/incomplete source evidence cannot substitute for this derivation | A resumed receipt grants a fresh future task or makes incomplete sources terminal | + +G1 is grounded in `decision_summary.goal_missing_state_blocker` / +`goal_status_health_ok` and `should_run._apply_missing_state_health_guidance`. +G2/G3 use `local_authority.read_canonical_todos_if_promoted`, +`shared_goal_work_source.read_shared_goal_work_source`, and +`test_real_directory_lifecycle_uses_canonical_state_despite_stale_audit`. +G4–G6 use the shared `quota_run_decision.json` fixture and the Python/TypeScript +decision tests. G7 uses the Python terminal projection in +`test_terminal_closure_precedes_automation_upgrade`; the terminal helper's full +implementation is outside this readset. The [ledger](source-ledger.json) and +[decision ownership](mechanisms.md#decision-ownership-and-order) link these +sources. + +## Accounting and retirement cases + +| Case | Relevant input or observation | Expected interpretation / next check | Unsupported conclusion | +| --- | --- | --- | --- | +| A1: repeated commit | Same effect, full semantic request and Goal instance; a matching committed receipt exists | Validate receipt and artifacts. Return replay without a second index row, or repair missing artifacts under the original receipt | A new timestamp or lost response justifies a new effect ID | +| A2: conflicting request | Reuse an effect ID but change `source`, preview or another digest-covered semantic field | Reject with `effect_id_conflict`. Top-level transport timestamp/CAS changes are different from changes inside the complete preview | Identity equality alone makes a changed request equivalent | +| A3: competing new effect | Two different effects were prepared against the same observed index digest | The later new transaction fails its stale basis. Refresh the decision/basis; do not replace the digest merely to force admission | A new effect ID bypasses stale state | +| A4: partial local publication | Receipt exists; one expected artifact is missing or the final index row is its verified truncated prefix | Repeat the original commit to repair the receipt's artifacts. Conflicting JSON content, different Markdown text or an unrelated malformed row must fail; lookup-only replay does not run this repair | Any malformed index can be rewritten, or replay lookup is a repair command | +| A5: recreated Goal alias | Same Goal ID now refers to a new instance, or an alias-only caller encounters an exact-source row | Preserve and validate the exact `GoalRef`; reject incompatible ownership. Do not consume old-instance accounting as current | Same display ID means same lifetime | +| A6: external effect before receipt | External host/provider work may have completed; no durable local receipt or matching lookup row exists | Record uncertainty. Inspect the operation's independent identity/readback before any authorized retry | Local accounting guarantees external exactly-once, or a miss proves no charge | +| R1: retired event source | A legacy source has nonempty `events.jsonl` or one of the three retired aliases, including malformed bytes | Refuse that source, preserve bytes and expose incomplete coverage. Inspect/export with a compatible release before deliberately changing its active binding | Ignore events, replay them silently, delete them automatically, or fill the gap with rollout history | + +A1–A4 use `spend_commit.ts`, `accounting_artifact_transaction.ts`, +`test_quota_spend_commit_runtime.py` and the selected +`quota_spend_commit.test.ts` cases: exact-effect replay, changed-request/CAS +conflicts, partial-artifact repair and conflicting-identity/index rejection. +A5 follows `source_admission.ts` and the exact GoalRef checks in the transaction +and replay owners. A6 is an explicit deduction from the local accounting scope +and the retirement document's separately stated external-effect crash window; +it is not a reproduced failure. R1 uses `legacy_event_source.py` and +`test_retired_todo_event_source.py`. + +## Record a decision + +For an actual use, retain the applicable source revision, Goal/source identity, +observed input, selected action or refusal, and unresolved evidence. For an +accounting recovery, also retain effect identity, request semantics, index basis +and receipt availability. Separate an inspected source assertion, a locally +observed result and a proposed next action. Keep the original campaign verdict +and authorization unchanged. diff --git a/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/mechanisms.md b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/mechanisms.md new file mode 100644 index 000000000..7d36f47da --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/mechanisms.md @@ -0,0 +1,197 @@ +# Mechanisms and operating boundaries + +All source links below name LoopX commit +`f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9`. **Code** describes inspected control +flow; **test** describes assertions in upstream tests, not a local test result; +**document** describes stated intent; **deduction** is the resulting review +guidance. The [ledger](source-ledger.json) gives the inspected sections. + +## Authority and projections + +**Code:** `read_canonical_todos_if_promoted` retains a historical name but no +longer permits a Markdown fallback. It requires a loaded native result with a +recognized `source_authority`, `decision_read_from_provider=true`, +`legacy_fallback_used=false` and a consistent Todo read model. A requested +Todo/lease snapshot also requires leases and `provider_revision`. Missing or +failed authority raises its cause; it does not become a valid empty Todo list. +[Python reader](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/coordination/local_authority.py#L245-L333) + +The TypeScript list owner loads the selected provider once and builds Todos, +optional leases and acceptance guards from that head. It returns revision and +source-authority facts. `read_shared_goal_work_source` requires a declared state +path and runtime root, but takes its work items from this canonical read and +records its provider basis; it does not read Todo text from the display file. +[List owner](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/coordination/local_authority_read.ts#L292-L354), +[work-source caller](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/goals/shared_goal_work_source.py) + +| Layer | Responsibility | Unsafe substitution | +| --- | --- | --- | +| Provider selection and canonical snapshot | Choose and read current Todo authority; carry source, revision and record identity | A readable old Markdown file cannot rescue a lost provider | +| Source registration / exact Goal identity | Bind an observation or accounting request to its source and Goal instance | A registry witness is neither a grant nor a transaction spanning registry and provider | +| Markdown, Todo index and rollout annotations | Present current state and historical context | A historical event status cannot overwrite current Todo status or claim | + +**Code:** a missing provider selector does not redirect an existing SQLite +authority to File. The selector opener reports the missing selector. The +registry-source witness checks the recorded bytes and explicitly does not span +provider storage. This readset inspects these seams, not all provider internals. +[Provider selection](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/coordination/local_authority_provider.ts#L218-L252), +[source witness](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/coordination/authority_source.ts) + +**Test:** the retirement suite keeps current Todo status and claims when audit +events disagree. Its File/SQLite lifecycle case makes the provider unavailable +while readable stale Markdown remains; reads must fail or expose no authoritative +work, then recover after the provider is restored. This is different from a +successful empty snapshot. +[Authority counterexamples](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane/test_retired_todo_event_source.py#L32-L48), +[provider-loss case](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane/test_retired_todo_event_source.py#L229-L326) + +## Decision ownership and order + +**Code:** Python prepares source facts, Goal-scoped health, replan applicability, +terminal evidence and compatibility text. `resolve_quota_run_decision` sends +typed facts to `effect_runtime_result("quota.run_decision", ...)`. TypeScript's +`resolveQuotaRunDecision` owns the ordered base decision. Python merges only the +returned `quota_patch`, retaining source numbers and unrelated quota metadata. +The managed runtime call crosses to Node/TypeScript; this is not a standalone +pure Python quota kernel. +[Python adapter](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/decision_summary.py#L242-L312), +[typed owner](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/run_decision.ts), +[runtime boundary](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/effect_runtime.py#L1274-L1372) + +Read the following sequence with its conditions; it is not a universal ranking +of all work in LoopX. + +| Step in the typed owner | Condition and effect | +| --- | --- | +| Delivery guards | A non-running capability gate without monitor fallback closes normal/recovery delivery; `repair_bridge` enables capability repair. A workspace guard clears all lanes then enables workspace repair. A required automation-prompt upgrade clears all execution lanes. | +| Base action | Choose normal delivery, recovery, workspace repair, self-repair or capability repair from the remaining lanes. With none open, map operator/health/throttle/wait states to their skip/notify actions. | +| Replan | Without inbox priority, an applicable required replan needs healthy Goal facts, no workspace guard and no required prompt upgrade. It selects a bounded replan instead of normal/recovery delivery. | +| Terminal | Validated terminal-no-follow-up with no inbox priority clears execution lanes and stops recurring automation until explicit resume. It requires complete source/frontier evidence supplied by the Python side, not merely a zero visible count. | +| Inbox | A nonterminal required prompt upgrade still blocks inbox work. Otherwise a due reply or material review clears other lanes and selects its own bounded action; reply wins when both are due. Terminal-source inbox work retains its explicit exception. | +| Task coordination | A ready coordination contract refines only an admitted `normal_run`. It does not capture an inbox or repair action. A route hint is a separate returned patch, not permission to create work. | + +**Code:** `goal_missing_state_blocker` recognizes the selected Goal's +`state_file_missing` finding. `goal_status_health_ok` returns false for it; +unrelated Goal diagnostics are scoped separately. The final should-run facade +can replace an otherwise eligible health skip with `blocked_health` and the +finding's reconnect/retire guidance. Do not create a substitute Goal from a +generic recommendation when its declared active state is gone. +[Health input](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/decision_summary.py#L74-L137), +[missing-state guidance](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/should_run.py#L507-L543) + +**Test:** Python and TypeScript consume the same ordered-rule fixture. It covers +throttled/waiting/health states, explicit recovery, capability/workspace guards, +replan and terminal/inbox exceptions. Python also asserts that large integer +quota values and nested metadata survive the adapter. The small +`test_quota_decision_summary.py` tests only plan-item flattening; it does not +prove the complete decision system. +[Shared fixture](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane_ts/fixtures/quota_run_decision.json), +[Python assertions](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane/test_quota_run_decision.py), +[TypeScript assertions](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane_ts/quota_run_decision.test.ts) + +**Deduction:** `should_run=true` alone is insufficient. Retain `effective_action`, +normal/recovery/repair lane flags, state and reason. A throttle skip blocks the +closed delivery lane; an explicitly admitted recovery/repair action has its own +semantics. None of these fields enforces a provider-side currency ceiling. + +## Accounting identity and recovery + +**Code:** Python constructs a complete preview request, validates the Goal/path +boundary and requires an index basis for execution. It preserves the complete +preview across the large-local-snapshot transport. TypeScript owns spend +validation and the durable accounting transaction. It requires an eligible +preview, positive integer slots, and `after.spent_slots = before.spent_slots + +slots`, with a permitted spend disposition. The caller's validated +delivery-completion attribution survives a later repair frontier. +[Python facade](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/spend_commit.py), +[typed validation](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/spend_commit.ts#L258-L420) + +| Identity / observation | Inspected behavior | +| --- | --- | +| `effect_id` | Use explicit request identity; otherwise `preview.effect_ref`, settlement effect plus `#quota_spend`, or a deterministic hash of selected semantic fields. It identifies the accounting effect, not a proof that external work ran. | +| `request_digest` | Hash canonical key-sorted semantics: effect, root, Goal, source, complete preview, compact before/after, agent and exact GoalRef when present. Top-level `generated_at`, `execute` and CAS observation are excluded. Fields inside the complete preview still participate. | +| `expected_index_digest` | Compare the current run-index bytes before creating a new transaction. Another new effect from the same stale basis is rejected. A matching existing receipt is resolved before this new-effect CAS. | +| Exact `GoalRef` | Source-owned accounting requires Goal ID plus instance ID and source admission together. Admission checks current ownership under the handed-off local locks. An alias-only replay cannot consume an exact-source record. | + +Source identity and digest are defined in +[spend_commit.ts](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/spend_commit.ts#L278-L361). +The [source-admission seam](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/source_admission.ts) +and [Python lock handoff](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/accounting_admission.py) +are local ownership checks. Distributed lease correctness is outside this +readset. + +**Code:** preview constructs a record and, when a runtime root is present, +prospective paths and the observed index digest without publishing artifacts. +Execution serializes the local transaction, writes a per-effect `prepared` +receipt, materializes JSON/Markdown/index, then marks the receipt `committed`. +The receipt retains the expected index prefix's digest and byte length. +[Preview/commit owner](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/spend_commit.ts#L787-L931), +[transaction sequence](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/accounting_artifact_transaction.ts#L894-L1044) + +Distinguish two operations when recovering: + +- **Repeat the same commit:** a matching receipt must have the same effect, + request digest and Goal instance. Its artifacts are checked and missing + artifacts may be repaired; the result is `repaired` or `replayed`. Conflicting + existing JSON content or different Markdown text is rejected. A truncated final index row is repaired only + when it is the expected row prefix after the receipt's verified prior bytes. +- **Replay lookup (`operation="replay"`):** inspect existing spend-index rows, + resolve effect identity, and check Goal and valid agent identity. It does not + execute the commit repair sequence. `read_only=true` also avoids the index + mutation lock; a lookup miss is a miss, not evidence that external work never + happened. + +Relevant rows with conflicting `effect_ref` and commit metadata are rejected in +either direction. Non-quota or unrelated-effect rows are not treated as a +matching spend. An index match without a matching receipt is not silently +adopted as a newly committed transaction. +[Identity/replay lookup](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/accounting_artifact_transaction.ts#L418-L536), +[repair constraints](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/accounting_artifact_transaction.ts#L734-L891), +[Goal/agent replay check](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/spend_commit.ts#L556-L677) + +**Test:** upstream cases assert no-write preview, one row for repeated or +concurrent identical commits, conflict on changed request/stale index basis, +artifact repair, and refusal of conflicting identity/index content. These are +local accounting assertions, not tests of an external provider's billing. +[TypeScript accounting cases](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane_ts/quota_spend_commit.test.ts#L737-L1103), +[Python facade cases](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane/test_quota_spend_commit_runtime.py#L148-L251) + +The settlement event is append-only, while visible `spent_slots` is a rolling +window aggregate. The recorded before/after is a same-status-payload projection. +Later totals can stay flat or decrease when old spends expire; that does not +undo the event or prove a refund. +[Projection semantics](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/spend_commit.ts#L462-L505) + +## Retirement and external effects + +**Code/document:** a nonempty legacy `events.jsonl` or any bound +`state_event_log`, `state_events_file` or `event_log` is refused on the retired +Todo source route. The guard detects nonempty bytes without treating malformed +content as empty. The prescribed recovery preserves the file and inspects or +exports it with a compatible older release before deliberate removal of its +active binding/file. There is no automatic replay, deletion or Markdown +substitution. Empty/absent files contain no event-owned Todos. Current canonical +reads remain provider-owned and do not import stale audit files. +[Retirement guard](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/goals/legacy_event_source.py), +[retirement document](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/docs/architecture/rfcs/ledger/shared-goal-authority-state-provider-v0/2026-09-25-todo-event-retirement.md) + +**Test:** read/write selectors refuse without changing original state/event +bytes; completion requires canonical authority before validation effects. A +retired source makes that Goal unavailable and the Todo index incomplete while +healthy Goals remain visible. Historical rollout records cannot fill the gap. +[Refusal and portfolio cases](https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane/test_retired_todo_event_source.py#L52-L188) + +**Document:** the separate experimental supervisor receipt log explicitly leaves +the crash interval between an external host effect and its receipt unresolved. +**Deduction from the inspected accounting code:** quota receipt repair only +reconstructs local accounting artifacts; it does not add fencing to that +external operation. If an external effect happened and the receipt is missing, +an automatic retry can duplicate the effect. Resolve it using that operation's +own identity/readback and authorization contract; do not infer success or safe +re-execution from a local lookup miss. + +Local accounting idempotency, correct Goal admission and bounded next-action +selection establish neither external exactly-once execution nor a supplier-side +hard cost cap. The readset does not qualify provider backends, distributed +leases, all controller overlays, runtime integration, performance or agent +benefit. It introduces no executor, database, migration or automatic retry. diff --git a/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/source-ledger.json b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/source-ledger.json new file mode 100644 index 000000000..bb5dda691 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/loopx-goal-governance/source-ledger.json @@ -0,0 +1,337 @@ +{ + "status": "candidate", + "origin": "source-derived", + "empirical_validation": "not_run", + "agent_efficacy": "not_evaluated", + "source": { + "type": "repository", + "repository": "loopx-project/loopx", + "url": "https://github.com/loopx-project/loopx", + "commit": "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9", + "tree": "c2ce33feec908b70c3b582119c5d1fadbc038a16", + "inspected_on": "2026-10-26", + "access": "Original raw file bytes at the fixed commit, checked against the Git tree blob identities; no source installation or execution.", + "license": "Apache-2.0", + "notice": "NOTICE credits LoopX contributors and creator huangruiteng and retains MIT history through v0.4.7." + }, + "scope": { + "governing_issue": "https://github.com/InferMatrixLab/InferRSI/issues/149", + "tracking_issue": "https://github.com/InferMatrixLab/InferRSI/issues/91", + "owner": "workflows/governance/rsi-evidence/references/loopx-goal-governance", + "related_historical_issue": "https://github.com/InferMatrixLab/InferRSI/issues/137", + "related_historical_commit_preserved": "a6f28057b49fe03bb234fa6ce1bac5d61df0c58f" + }, + "evidence_classes": { + "code": "Inspected source control flow, not reproduced runtime behavior.", + "document": "Pinned author-stated intent and limits.", + "test": "Inspected upstream assertions, not local test outcomes.", + "deduction": "Review guidance derived from the stated code/document boundary; not an observed incident.", + "discovery-only": "Actually inspected to locate the owner; excluded from mechanism support and coverage credit." + }, + "readset": [ + { + "path": "LICENSE", + "kind": "license", + "inspected_scope": "Full original bytes; Apache-2.0 terms.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/LICENSE", + "git_blob_sha": "d645695673349e3947e8e5ae42332d0ac3164cd7", + "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30", + "bytes": 11358 + }, + { + "path": "NOTICE", + "kind": "notice", + "inspected_scope": "Full original bytes; creator/contributor attribution and through-v0.4.7 MIT history.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/NOTICE", + "git_blob_sha": "45a3556ecf5e5d6fc04755d5b94f22cd90428346", + "sha256": "3c3c36a40e1d65f3a6b20ec3a97319cb753e857f1d120f302cd828e107120f6d", + "bytes": 308 + }, + { + "path": "LICENSE-MIT", + "kind": "historical-license", + "inspected_scope": "Full original historical MIT text; not a license substitution for current source.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/LICENSE-MIT", + "git_blob_sha": "f5746a7eee9f275edd9b23f3ac1af27d02e9cd2d", + "sha256": "1df1cf519b9e5d8acbbc72820299d7aa95afa1acbfc1f43a15109ad1d59975f3", + "bytes": 1075 + }, + { + "path": "loopx/control_plane/quota/run_decision.ts", + "kind": "code", + "inspected_scope": "Complete file: typed fact decoding, ordered guards, action selection and returned patches.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/run_decision.ts", + "git_blob_sha": "751c96b2869724903dd0ee6bff3dc855d4f3d7db", + "sha256": "dfd6d391a8042b0eb2a538b11140dec6179b4ecfbe8244ef481f21a22e3b374a", + "bytes": 11418 + }, + { + "path": "loopx/control_plane/quota/decision_summary.py", + "kind": "code", + "inspected_scope": "Complete file: compact packet, Goal-scoped health, recommendation refinement, typed runtime adapter and patch merge.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/decision_summary.py", + "git_blob_sha": "8a279260ea0428dabde1ae02f1239a8aab32fe36", + "sha256": "0d85de8174aeb23946917ee3a65a523dbe7f622c6d8e8cd57c316dfb430af737", + "bytes": 12469 + }, + { + "path": "loopx/control_plane/quota/spend_commit.ts", + "kind": "code", + "inspected_scope": "Lines 1-420 and 462-677, 787-931; identity/digest, validation, record, native replay, preview and commit. Payload rendering between these sections only located by symbol search.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/spend_commit.ts", + "git_blob_sha": "7a4f7eab4ad3a5c8be9af30c0fde2f1167b7699c", + "sha256": "626b38c6a101ff6653c7e6910939f579a86cfd196792cb664f3f625dfa0c32fc", + "bytes": 31263 + }, + { + "path": "docs/architecture/rfcs/ledger/shared-goal-authority-state-provider-v0/2026-09-25-todo-event-retirement.md", + "kind": "document", + "inspected_scope": "Complete retirement brief, compatibility/refusal, canonical versus legacy routes and separate supervisor external-effect limit.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/docs/architecture/rfcs/ledger/shared-goal-authority-state-provider-v0/2026-09-25-todo-event-retirement.md", + "git_blob_sha": "274866bf5b2640da8c1f5a6b544cfc26ec17a3fa", + "sha256": "b841e73af4466dad018fff880e38275c91a2315942dc91a7d23e453b885cead7", + "bytes": 3082 + }, + { + "path": "tests/control_plane/test_quota_run_decision.py", + "kind": "test", + "inspected_scope": "Complete file: Python adapter assertions, terminal fixture, ordered rules, inbox exception and source-number preservation.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane/test_quota_run_decision.py", + "git_blob_sha": "33481d70435682dd0eb4e63e5a2481bea72ae1eb", + "sha256": "0417ef3614bd7a6e4b9b461e846851c8ae02afab54a8ae08f3bc2b289321cf05", + "bytes": 12584 + }, + { + "path": "tests/control_plane/test_quota_decision_summary.py", + "kind": "test", + "inspected_scope": "Complete file: plan-item flattening only; not full decision coverage.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane/test_quota_decision_summary.py", + "git_blob_sha": "8e864cedec10d5d3e0994e225920745745d9dda6", + "sha256": "69bcbf4b346b2fe53823529ab4956ae3e8cbce0777811636d30ca88cb3895f01", + "bytes": 752 + }, + { + "path": "tests/control_plane/test_quota_spend_commit_runtime.py", + "kind": "test", + "inspected_scope": "Imports; lines 148-251 and 329-418; native typed facade, concurrent exact retries, complete preview retention, stale basis and boundary rejections. Other tests located by name only.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane/test_quota_spend_commit_runtime.py", + "git_blob_sha": "bfa94dbf83eb68a7c394913df613cfeaa49a74fd", + "sha256": "67ae3337c27a9aa5e9ad6af7397a20636de273fe38a808a9a4356acfae1d0bb0", + "bytes": 14649 + }, + { + "path": "tests/control_plane_ts/quota_run_decision.test.ts", + "kind": "test", + "inspected_scope": "Complete file: shared rule fixture, malformed facts and coordination route-hint assertions.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane_ts/quota_run_decision.test.ts", + "git_blob_sha": "dc6ec5c00cac0d7a0bb3ee26df2d0a0c7ba97021", + "sha256": "b6c1f0704ba7385d77448970707d3e3aa93647f6b057cb1fa59d5e9c91897aef", + "bytes": 2270 + }, + { + "path": "tests/control_plane_ts/quota_spend_commit.test.ts", + "kind": "test", + "inspected_scope": "Lines 236-344, 737-813 and 941-1103: preview/rejection, commit replay, conflicting versus unrelated identity, partial-artifact/tail repair, prefix/row conflict, CAS and concurrent retries. Other source/lock cases located by name, not used to qualify leases.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane_ts/quota_spend_commit.test.ts", + "git_blob_sha": "553c25ed95c4313b0cdef71c7957af7f614be6ca", + "sha256": "06eddc569b5cb26fc8d70379d24f91893f2420645cd6c6cdc57de86909329eb6", + "bytes": 35895 + }, + { + "path": "loopx/control_plane/quota/accounting_artifact_transaction.ts", + "kind": "code", + "inspected_scope": "Lines 1-125, 390-536 and 734-1044; receipt contract, identity/replay, missing/conflicting artifact checks, prefix/tail repair and local commit order. Receipt path-validation symbols located, not a complete security audit.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/accounting_artifact_transaction.ts", + "git_blob_sha": "576deb432329d000af1c00b8ec812b8662f2c2d5", + "sha256": "821545fd7ef4e1c1e4b75af506c8a52d312873919e3233c06570a33182ec7d6c", + "bytes": 34291 + }, + { + "path": "loopx/control_plane/quota/source_admission.ts", + "kind": "code", + "inspected_scope": "Complete file: alias versus exact GoalRef, admission pair, local lock-witness adoption, current-owner check and cleanup; underlying lock implementation excluded.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/source_admission.ts", + "git_blob_sha": "47526e2a75935f864a1699e0383e5bff3e194836", + "sha256": "6da4d0c619725233b283fc31168feada913a724ab5048eba52cca4641d26604d", + "bytes": 10857 + }, + { + "path": "loopx/control_plane/quota/accounting_admission.py", + "kind": "code", + "inspected_scope": "Complete file: Python exact-source/legacy admission and ordered local lock handoff; no distributed-lease qualification.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/accounting_admission.py", + "git_blob_sha": "3ea97a9eead60c6db37e0ff3be0d78cacc86f3cc", + "sha256": "3f687091fa2ffe41f5e0d528b7e2e330c0ae07109302773a2fdebbb8c2f8952a", + "bytes": 3696 + }, + { + "path": "tests/control_plane_ts/fixtures/quota_run_decision.json", + "kind": "test-fixture", + "inspected_scope": "Base facts/results, cases through replan/terminal/inbox plus closed-lane cases; all case names inspected. This is a shared expected-rule fixture, not a local result.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane_ts/fixtures/quota_run_decision.json", + "git_blob_sha": "9e81c71c503e348f647f3bc77556ef4dc9a1e9f0", + "sha256": "7a5861021f2e8eda8f3f7c70d452a54b09aeeef171ab91c309d780b30ac457fb", + "bytes": 14721 + }, + { + "path": "tests/control_plane/test_retired_todo_event_source.py", + "kind": "test", + "inspected_scope": "Lines 1-188 and 229-326; audit cannot override current status, nonempty/empty event sources, validation-before-authority refusal, scoped portfolio incompleteness, canonical provider loss/restoration. HTTP case located but not read in full.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/tests/control_plane/test_retired_todo_event_source.py", + "git_blob_sha": "3cf34c9a38bd74817780fa24fc8c5cfd3a8a1f3c", + "sha256": "0cef96cc0df93a6cf69326968c0cac3e42fbec9f137dad8d49b8338a38cba236", + "bytes": 17707 + }, + { + "path": "loopx/cli_commands/todo_event.py", + "kind": "discovery-only", + "inspected_scope": "First 95 lines: error/audit logging helper; not the retired Todo source authority. Excluded from mechanism support.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/cli_commands/todo_event.py", + "git_blob_sha": "d59260d6980c35f423504b1b545e7e9a27a94bfd", + "sha256": "01d8a86e0820c967a43920cd9dea462aa35365e555d9046eebb948eb6df799fd", + "bytes": 7397 + }, + { + "path": "loopx/control_plane/todos/update_source.py", + "kind": "discovery-only", + "inspected_scope": "Complete small snapshot helper inspected during caller discovery; not a provider authority or write protocol. Excluded from mechanism support.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/todos/update_source.py", + "git_blob_sha": "2bafe1f0345b48ad54073f4c274808831177e00d", + "sha256": "0f0d37f3d333008f6f6068cc5f44cc7cf4a270724090daf93827377c55fdb8c4", + "bytes": 1380 + }, + { + "path": "loopx/control_plane/quota/should_run.py", + "kind": "code", + "inspected_scope": "Missing-state health guidance at lines 507-543; relevant action/health and acceptance guard search contexts only. Not a complete controller/overlay readset.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/should_run.py", + "git_blob_sha": "21ebc67e262e7fc24ba3ef3073c0b98a48d39543", + "sha256": "ebadbec6276a764e6d2dd42e8c84fa87710fb0872168fc257b459009581b4c5d", + "bytes": 28948 + }, + { + "path": "loopx/control_plane/quota/should_run_prepare.py", + "kind": "code", + "inspected_scope": "Source-selection/capability/receipt-resume search contexts and lines 731-840 only; source facts have separate preparation and receipt resume does not grant new work. Rest excluded.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/should_run_prepare.py", + "git_blob_sha": "fdb68941165252e9999d20d153cb220ca40afc05", + "sha256": "37f1c3673882b67f89675187d08ea83170f29d5ccd291fa63ffdca18f5ade523", + "bytes": 41168 + }, + { + "path": "loopx/control_plane/quota/spend_commit.py", + "kind": "code", + "inspected_scope": "Complete file: complete preview request, typed result/error adapter, native replay, execution index basis and lock/admission owner.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/spend_commit.py", + "git_blob_sha": "5ddc370ba6fcea4ecf0c9f416eaab0ae3da97d23", + "sha256": "8b5f2a8a38f7090d3a306bb0b436e2b154cf17c687b1b70ab3d6a9d0b17eb68d", + "bytes": 11986 + }, + { + "path": "loopx/control_plane/goals/shared_goal_work_source.py", + "kind": "code", + "inspected_scope": "Complete file: read Todos and leases at one canonical provider basis, no state-text work fallback.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/goals/shared_goal_work_source.py", + "git_blob_sha": "04c3583385e9058328455ea5c6f59ef1e6fdcabf", + "sha256": "0b3b92d8ce7e22a8080ef6a7f17ddfebbb60019a8508d21e70fcaf46386f6859", + "bytes": 2386 + }, + { + "path": "loopx/control_plane/goals/legacy_event_source.py", + "kind": "code", + "inspected_scope": "Complete file: three retired aliases plus adjacent events.jsonl, nonempty-byte refusal and preservation guidance.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/goals/legacy_event_source.py", + "git_blob_sha": "59f06883bd5af9574fff1d21c82a7d8b09aa1589", + "sha256": "e4fd7bd6d28cc53a1bcc6587cf2a2b687c71472ab0fb2adbd8b93baead0b5084", + "bytes": 1592 + }, + { + "path": "loopx/control_plane/coordination/local_authority.py", + "kind": "code", + "inspected_scope": "Lines 245-445: canonical-read validation, no Markdown fallback, incomplete/failed source rejection, request-local snapshot scope and canonical display adaptation.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/coordination/local_authority.py", + "git_blob_sha": "b4f88c5f5de73b0c90a95ea0b86cec9e3290886c", + "sha256": "1b50a7d0db7b68384c3f10fef04f9fa4e316d8d0dbc0b55dae013077e61309b8", + "bytes": 18321 + }, + { + "path": "loopx/control_plane/coordination/authority_source.ts", + "kind": "code", + "inspected_scope": "Complete file: registry source byte witness and its explicit non-grant/non-transaction boundary.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/coordination/authority_source.ts", + "git_blob_sha": "2779466d3281de25b131f77037091d10a4c8baec", + "sha256": "7c516799c4be782a0baf9d71ed28b14fa40f50937f8d49c29bb6a3b58470806c", + "bytes": 2080 + }, + { + "path": "loopx/control_plane/coordination/local_authority_read.ts", + "kind": "code", + "inspected_scope": "listLocalCoordinationTodos, lines 292-354; selected provider head and returned source/revision/no-fallback facts. Other functions located by symbols only.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/coordination/local_authority_read.ts", + "git_blob_sha": "f76cddd6ecef3b7bf59608c4e42109a49f8b8a3c", + "sha256": "2b06eaf17a72a96b867619e84376ac5625c26fb7772a350081a4117e31c57887", + "bytes": 18388 + }, + { + "path": "loopx/control_plane/coordination/local_authority_provider.ts", + "kind": "code", + "inspected_scope": "Provider declarations and lines 218-325; missing selector does not redirect initialized SQLite authority, selected provider seam. Backend implementations excluded.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/coordination/local_authority_provider.ts", + "git_blob_sha": "50007652797e69897428112dbabe5580c0473b07", + "sha256": "020b3bbc0807787d8eec1f2fd4a7d1ad5774aa3ac182fab3a9d2d68e3c73dd8e", + "bytes": 17350 + }, + { + "path": "loopx/control_plane/effect_runtime.py", + "kind": "code", + "inspected_scope": "Managed Node/TypeScript path/start/request/result boundaries by search context, including lines 1274-1372. No runtime execution or lifecycle qualification.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/effect_runtime.py", + "git_blob_sha": "fea81a4694d81ab1fa9f7d6935d92a3f7e3a61c9", + "sha256": "a1f4f49f433f8587afaaeffa40c64945d6fc4c69a43b00a71acd06a6d051b4d0", + "bytes": 59173 + }, + { + "path": "loopx/control_plane/quota/goal_boundary.py", + "kind": "discovery-only", + "inspected_scope": "Goal boundary/capability declarations located and source sampled; not the missing-state health owner. Excluded from mechanism support.", + "url": "https://github.com/loopx-project/loopx/blob/f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9/loopx/control_plane/quota/goal_boundary.py", + "git_blob_sha": "4e8f18adab4026773f68933f33ad961e652d1311", + "sha256": "dbce5a542287def0c4efe1f01ad76874df3a1be3013c2d0b4ebf210f29fa7872", + "bytes": 19235 + } + ], + "preserved_originals": [ + { + "source_path": "LICENSE", + "resource": "LICENSE", + "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30", + "bytes": 11358 + }, + { + "source_path": "NOTICE", + "resource": "NOTICE.md", + "sha256": "3c3c36a40e1d65f3a6b20ec3a97319cb753e857f1d120f302cd828e107120f6d", + "bytes": 308 + }, + { + "source_path": "LICENSE-MIT", + "resource": "LICENSE-MIT.md", + "sha256": "1df1cf519b9e5d8acbbc72820299d7aa95afa1acbfc1f43a15109ad1d59975f3", + "bytes": 1075 + } + ], + "exclusions": [ + "Most of the repository, UI, host adapters and complete quota controller/receipt overlays.", + "Storage/provider implementations, provider capacity/soak behavior and distributed lease correctness.", + "Full terminal/frontier derivation implementation; terminal evidence shape is inspected in the adapter/tests.", + "Supervisor runtime implementation; only the retirement document's separate external-effect boundary is used.", + "Source installation, native LoopX tests, external provider effects/billing, agent trials, model/device/quality/performance validation.", + "vLLM adoption reports are not used as causal performance or efficacy evidence." + ], + "limitations": [ + "Original-byte identity authenticates file contents, not full-file semantic review; inspected_scope states the actual readset.", + "Python source preparation and TypeScript decisions/accounting remain distinct; no pure Python quota kernel is extracted.", + "Local accounting idempotency and repair do not establish external exactly-once execution or supplier hard cost ceilings.", + "This candidate does not implement InferRSI goal checkpoints or promote the inherited owner." + ] +} diff --git a/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/omni-experiments.md b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/omni-experiments.md new file mode 100644 index 000000000..40a8e8a72 --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/rsi-evidence/references/omni-experiments.md @@ -0,0 +1,99 @@ +# Qualifying Omni optimization experiments + +Use this protocol when a multimodal pipeline has feedback, stochastic audio +sampling, internal graphs, or stateful streaming. Freeze selected checks and +quality tolerances in the acceptance issue and `plan/` before searching. This +adds no default hardware job or model-specific threshold. + +## Reference and preflight + +- Map per-step feedback before splitting stages: a depth head whose output feeds + the next temporal step may need to stay in the same AR stage. Module names do + not establish process boundaries. +- Pin reference code/checkpoint, dependency versions, dtype, attention backend, + buffer construction device, and cast/move order. Nonpersistent rotary buffers + can differ despite identical weights. Match per-request RNG device, random + operation order/shapes and reveal schedule, not just a seed. Locate the first + divergent token/frame before relaxing tolerances. Isolate reference packages + when serving requires a different supported dependency range. +- Compare full decode with reference full decode, and streaming with reference + streaming under the same codec chunk schedule. Measure the reference's own + full/stream difference separately; it cannot excuse additional integration + error. Keep transport chunk coalescing from silently changing decoder shapes. +- Inventory outer and internal graph switches, effective backend, capture, + replay and fallback. An outer eager flag may leave component graphs enabled. +- Preflight the benchmark consumer with metadata-only, empty-final and coalesced + payloads. Count first audio only on nonempty samples while preserving completion + events. Distinguish text-end, audio-end and request-end; verify flush and abort + cleanup. Preserve processor signatures when adding diagnostic wrappers. +- Validate mixed prompts, seeds and lengths concurrently, cancellation followed + by a new request, and the campaign's accuracy dataset. Repeating one prompt + or matching a few fixtures does not replace these checks. + +## Executable trial qualification + +Select adapter-produced boolean fields with repeatable CLI options, for example: + +```text +--require-trial-check evidence.requests_complete +--require-trial-check evidence.workers_closed +--require-trial-check evidence.graph_controls_verified +``` + +Use the same flags for `inferrsi plan` and `inferrsi run`. They are frozen as +`required_trial_checks` in `run.lock.json`. Each baseline and candidate benchmark +command writes its normal metric plus the selected fields to `{result}` (or +`INFERRSI_RESULT_PATH`), for example: + +```json +{ + "metrics": {"latency_ms": 100}, + "evidence": { + "requests_complete": true, + "workers_closed": true, + "graph_controls_verified": true + } +} +``` + +These are illustrative adapter-defined keys, not built-in hardware probes. Derive +fields from actual request counts, worker exit receipts, and effective graph +controls; keep the underlying receipts in the trial's output directory. Emit +completion only after checking worker exits. Process exit zero, lack of an error +message, or executor-forced cleanup does not establish normal worker shutdown. +Never hardcode `true` to obtain a verdict. + +The harness snapshots only selected boolean fields into each `execution.json`. +Literal `true` is required on every measured trial, on both arms. Missing, +unreadable, non-boolean or false values make the comparison `INCONCLUSIVE` and +leave `improvement_pct` unset; raw metrics remain available for diagnosis. +Qualification describes completeness and comparability, not an accuracy score: +quality rejection still belongs to the explicit validation command and its frozen +gates. A completed quality rejection remains `FAIL` when evidence is otherwise +complete. No selected checks preserves the existing command contract; it does +not imply lifecycle or graph qualification. Adapter attestations do not replace +independent validation, source integrity, L3 quality or L4 service evidence. + +## Comparable experiments and repair + +Use the site's reservation mechanism on shared devices (such as `npu run` where +provided). Freeze device allocation, workload and software, including CANN, +torch-npu and vllm-ascend for Ascend. Record contention and graph/backend settings; +CUDA tooling and MPS are platform-specific. Use portable device labels in shared +artifacts and keep private machine addresses out of logs. + +Retain the common AB/BA loop. Report independent process repetitions separately +from requests within each process. Warm up before steady-state measurements; +report startup/capture costs separately when relevant. A new model unsupported +on upstream main needs a clearly labelled integration-with-optimizations-off +control, not a fabricated main baseline. + +Retain failed and slow attempts. If a consumer or harness bug is repaired, start +a fresh complete comparison with new frozen commands/source/validator identities; +do not splice successful samples across attempts or rewrite old evidence. A +receipt failure does not automatically retry commands or reserve more hardware. + +Skipping multimodal memory profiling can help diagnosis but cannot qualify +deployment capacity. Exercise normal profiling at declared modality limits and +headroom at target concurrency. Distinguish sampled device memory from allocator +peaks, component timing from service timing, and request success from clean exit. diff --git a/src/inferrsi/knowledge/atoms/workflows/skill-evolution-playbook.md b/src/inferrsi/knowledge/atoms/workflows/skill-evolution-playbook.md new file mode 100644 index 000000000..55135276c --- /dev/null +++ b/src/inferrsi/knowledge/atoms/workflows/skill-evolution-playbook.md @@ -0,0 +1,217 @@ +--- +name: skill-evolution-playbook +description: 'Practical design choices for evolving agent skills from execution traces: when one trajectory should update a skill, how conflicting lessons are handled, how negative evidence is preserved, how large an edit should be, and when skills should split or merge. Drawn from Trace2Skill and SkillOpt. Use when designing or operating a skill evolution pipeline. + + ' +metadata: + inferrsi: | + { + "tags": [ + "skill-evolution", + "trace2skill", + "skillopt", + "rsi" + ], + "status": "candidate", + "profile": "local-skill-v1", + "schema_version": 1, + "kind": "skill", + "origin": [ + "external" + ], + "empirical_validation": "not_run", + "applicability": { + "scope": "Design choices for evolving agent skills from execution traces, drawn from Trace2Skill and SkillOpt: when a trajectory should update a skill, how conflicting lessons are handled, how negative evidence is preserved, how large an edit should be and when skills split or merge; for designing or operating a skill evolution pipeline", + "prerequisites": "A final-test partition kept outside edit selection and the incumbent skill retained for rollback; changing a skill's scope first needs explicit review of its identity and consumers", + "input_contract": "Execution trajectories or trace IDs with the diagnosed causal failure and the successful behavior an amendment must preserve; the incumbent skill and its revision lineage; held-out evaluation results for candidate edits", + "produced_artifact": "A scoped case or amendment proposal, or a consolidated candidate edit, with rejection records and the versioned revision lineage; a candidate for independently evaluated acceptance, not a replacement decision or an efficacy claim", + "failure_modes": [ + "An anecdote, or agreement among analysts, is taken as efficacy", + "Consolidation output is treated as a replacement decision instead of a candidate awaiting independent acceptance", + "A tie or uncertain result is reported as improvement", + "A conflict is resolved by voting for whichever outcome appeared more often in the pool", + "A rejection is applied to every future use of an idea instead of the comparison it constrains", + "Paper-specific section counts or length budgets are used as universal defaults, or a skill is split on length alone", + "A stronger task solver is assumed to be a stronger improver, or replay rankings and private inner scores are read as outer generalization" + ], + "refusal_point": "Records a conflict that conditioning cannot resolve, where the same context produces different outcomes across runs, as INCONCLUSIVE and flags it for human review instead of choosing a lesson; claims no universal minimum trace count, paper-to-code equivalence or local efficacy" + }, + "recommendations": [ + "Condition a conflicting lesson on its context (when X, do A; when Y, avoid A) before choosing one side.", + "Store each rejection record with its evaluation evidence, outside the deployed task procedure, and give it a retirement condition.", + "Bound the target passage and intended behavior before editing, inspect the actual diff and preserve rollback state.", + "Prefer an amendment when the existing skill owns the workflow; create a new candidate only for a genuinely distinct capability." + ], + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets." + ], + "provenance_readsets": [], + "consumption_mode": "packaged", + "searchspace_not_applicable": "SKILL.md §§ When should one trajectory update a skill?, How large should a skill edit be?, and When should skills split or merge? govern skill-text evolution and held-out evaluation, not hardware-resource state or control." + } +--- + +# Skill Evolution Playbook + +Status: candidate. Repository-derived notes record Trace2Skill @ 3d0b52a +and SkillOpt @ 343db229; the earlier Trace2Skill attribution to 7e5a1d77 belongs +to LearningToCommit and does not establish that implementation's behavior. +The [reviewed paper ledgers](../npu-skill-factory/references/papers-20261015/references/readset.md) +keep Trace2Skill v5 and SkillOpt v2 separate from these repository pins. No +paper-to-code equivalence or local efficacy is established. + +## When should one trajectory update a skill? + +A single trajectory can motivate a scoped case or amendment proposal. Diagnose +its causal failure first and retain successful behavior the amendment must +preserve. Neither an anecdote nor agreement among analysts establishes efficacy. +No universal minimum trace count follows from these papers. + +Trace2Skill's reviewed paper describes evidence-pool analysis and consolidation; +SkillOpt separates proposal generation from independently evaluated acceptance. +Consolidation produces a coherent candidate, not a replacement decision. Keep +final-test partitions outside edit selection, check combined effects and +unrelated-success regressions, and retain the incumbent for rollback. A tie or +uncertain result must not be reported as improvement. + +See [Trace2Skill evidence](../npu-skill-factory/references/papers-20261015/references/trace2skill.md), +[SkillOpt evidence](../npu-skill-factory/references/papers-20261015/references/skillopt.md) +and [interaction counterexamples](../npu-skill-factory/references/papers-20261015/cases/methodology-counterexamples.md). + +## How are conflicting lessons handled? + +Two trajectories can encode contradictory lessons: one shows approach A works, +another shows approach A fails. + +**Trace2Skill's approach:** parallel multi-agent patch proposal followed by +hierarchical conflict-free consolidation. The `skill_evolver` agents each +propose section-level patches (`insert_after`, `replace_in_section`, +`add_section`, etc.); the consolidation step identifies conflicting edits to +the same section and resolves them through a separate consolidation model call. +Source: `skill_evolver/skill_evolving_agent.py`, `_SUPPORTED_PATCH_OPS` (historical code locator; pin attribution unresolved, not reverified). + +**Practical resolution strategies:** +1. **Context-condition the lesson.** If A works in context X but fails in + context Y, the skill should encode both as conditional: "When X, do A. + When Y, avoid A." This is better than choosing one and losing the other. +2. **Separate sections.** Conflicting lessons often target different conditions. + Add a "known failure modes" or "does not apply when" section rather than + overwriting the "procedure" section. +3. **Escalate to human review.** When the conflict cannot be resolved by + conditioning (the same context genuinely produces different outcomes across + runs), record it as INCONCLUSIVE and flag for human review. Do not resolve + by voting on whichever outcome appeared more often in the pool. + +## How is negative evidence preserved? + +**SkillOpt:** rejected candidate edits are stored in the staging area with +their evaluation result before being discarded. The staging state records +what was tried and why it was rejected. +Source: `skillopt_sleep/staging.py` @ 343db229. + +**Trace2Skill:** error traces are analyzed separately from success traces, and +both pools contribute to the consolidated edit. Error-driven evolution produces +failure-mode additions to the skill; success-driven evolution adds positive +procedure refinements. Neither is discarded. +Source: Trace2Skill `run_parallel_skill_evolution.py` (error traces) vs +`run_parallel_combined_skill_evolution.py` (combined success+error traces) (historical code locator; pin attribution unresolved, not reverified). + +**What to preserve in a rejection record:** +```yaml +rejected_edit: + proposed_change: + hypothesis: + held_out_result: + verdict: FAIL or INCONCLUSIVE + evidence_level: + context: + date: +``` + +A rejection record is editing context: keep incumbent/candidate identities, +target conditions, measured outcome, suspected cause and a retirement condition. +Store it with the corresponding evaluation evidence, outside the deployed task +procedure. Rejection constrains that comparison, not all future uses of an idea. +Protected guidance can be revised explicitly when its supporting evidence expires. + +## How large should a skill edit be? + +**SkillOpt's bounded edit:** modifications are restricted to specific sections +(`procedure`, `failure_modes`, `knowledge_sources`). The `clip.py` module +enforces a length budget: the candidate must not be substantially longer than +the current skill. The `revision.parent` field tracks the lineage so v0→v1→v2 +is reconstructible. +Source: `skillopt/optimizer/clip.py`, `skillopt/optimizer/skill.py` @ 343db229. + +**Trace2Skill's section-level patches:** edits target named sections with +specific operations. `replace_in_section` replaces content within a section, +`insert_after` adds content after a named anchor. Protected files (`LICENSE.txt`, +`recalc.py`) cannot be modified regardless of what the patch proposes. +Source: `skill_evolver/skill_evolving_agent.py` PROTECTED_FILES, PATCH_OPS (historical code locator; pin attribution unresolved, not reverified). + +**Practical size rule:** bound the target passage and intended behavior before +editing, inspect the actual diff, and preserve rollback state. Paper-specific +section counts and length budgets are not universal defaults. Changing a skill's +scope requires explicit review of its identity and consumers; consolidation or +splitting is justified by distinct workflows and observed interactions, not an +arbitrary word count. + +## When should skills split or merge? + +**Split a skill when:** +- The `procedure` has grown to cover two distinct workflows that rarely co-occur. + The signal: most trajectories use only the first half or only the second half, + rarely both. +- Two distinct `applicability` conditions consistently produce conflicting lesson + proposals. The conflict is structural, not resolvable by conditioning. +- Agents repeatedly need only a separable workflow with its own trigger and + evidence contract; length alone is not a split criterion. + +**Merge skills when:** +- Two skills consistently co-activate (every trajectory that uses skill A also + uses skill B, with little overlap with other skills). +- One skill's `procedure` duplicates a large portion of another's. +- The two skills' `applicability` conditions are indistinguishable in practice. + +**What to version when splitting:** +The original skill becomes deprecated (v_last) with a forward pointer to both +new skills. Both new skills start at v0 with `revision.parent = `. + +## Skill deepening vs skill creation + +Trace2Skill studies two modes: +- **Self-deepen:** start from an existing human-written skill; use traces to + refine procedure, add failure modes, and extend coverage. +- **Self-create:** start from a minimal draft (e.g., name + description only); + build up from error traces. + +Neither mode is universally superior. A relevant incumbent offers useful +structure, but model/harness-specific regressions and task-conditioning matter. +Prefer an amendment when the existing skill owns the workflow; create a new +candidate for a genuinely distinct capability. See the reviewed Trace2Skill v5 +ledger and its human-skill/small-model counterexample before claiming transfer. + +## Task solver and improver are different claims + +Use the [adaptation-interface records](../../../playbooks/planning/optimization-search-policy/references/papers-20261015/knowledge/adaptation-interfaces.md) +for Dream-RSI replay support, AIDE²'s separate inner/private/outer evaluation +boundaries and JitRL's candidate-scoring prerequisites. A stronger task-solving +agent is not automatically a stronger improver. The AIDE² improver comparison +remains inconclusive; later checkpoints can regress on individual held-out domains. +Replay rankings and private inner scores are not untouched outer generalization +evidence. These records enable no execution interface or persistent memory store. + +## What should be versioned? + +- The skill document itself (`SKILL.md`) at each accepted version. +- The trajectory pool or trace IDs that motivated each edit. +- The held-out evaluation result (metric before → after) for each accepted edit. +- Rejected candidates and their evaluation results. +- The `revision.parent` chain so the full lineage is reconstructible. + +What does NOT need to be versioned separately: +- The raw agent trajectories (store a reference/ID, not a full copy). +- Intermediate patch proposals that were not accepted. +- The evaluation harness configuration (that is versioned separately in the + benchmark/evidence tree). diff --git a/src/inferrsi/knowledge/compositions/draft-acceptance-issue.json b/src/inferrsi/knowledge/compositions/draft-acceptance-issue.json new file mode 100644 index 000000000..ad989d28f --- /dev/null +++ b/src/inferrsi/knowledge/compositions/draft-acceptance-issue.json @@ -0,0 +1,109 @@ +{ + "authority": "checkout", + "metadata": { + "id": "draft-acceptance-issue", + "kind": "skill", + "entrypoint": "workflows/governance/draft-acceptance-issue/SKILL.md", + "title": "Draft a campaign acceptance issue with checklist, RunSpec, evidence paths, and placeholders for baseline/candidate SHAs.", + "origin": [ + "first-party" + ], + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/draft-acceptance-issue/SKILL.md", + "sha256": "2c14533c067c51b9763f80a9df0bf5eb5acd398f4265790c57039fed96d4c497" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "applicability": { + "scope": "Opening a new acceptance campaign in an RSI-style repository, before any baseline or candidate run", + "prerequisites": "A chosen campaign subject and an empty evidence// tree copied from evidence/_template/; SHAs may still be placeholders", + "input_contract": "A campaign id of the form {model-or-scenario}/{device}x{count}, any user-supplied criteria or accepted plan, and available workload/baseline/calibration evidence for deriving missing targets", + "produced_artifact": "An acceptance issue body with campaign id, pinned baseline and candidate SHAs, RunSpec, criteria source and derivation including gaps and freeze authority, gates, evidence paths, initial verdict and a downstream citation blurb", + "failure_modes": [ + "Gates written after the search loop has already run", + "Campaign SHAs committed into recipes/, benchmarks/, skills or workflow defaults", + "PASS claimed without a validator/ freeze and a results/ rationale" + ], + "refusal_point": "Refuses to state a verdict other than INCONCLUSIVE while the validator freeze or results rationale is absent" + }, + "state": "candidate", + "limitations": [ + "Drafts an issue only; it freezes no gate and runs no measurement.", + "The placeholder SHA convention depends on the campaign owner filling them in later.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "required_resources": [ + "workflows/governance/draft-acceptance-issue/SKILL.md" + ], + "composition": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "nodes": { + "navigation": { + "ref": "checkout:draft-acceptance-issue.original.navigation", + "revision": "sha256:ac98627b1dea3fd5eb68642d4c3c77efd78b3de7e9147fda45d90a0d9d27cfdf" + }, + "decision": { + "ref": "checkout:draft-acceptance-issue.original.decision", + "revision": "sha256:a66294ae6e9c9766cf38903b4c6c5c5b6f72ccde4ba3833fffe8dc38ceefcf34" + }, + "procedure": { + "ref": "checkout:draft-acceptance-issue.original.procedure", + "revision": "sha256:c4631e08a93c836f6f213bbc0988e79134f57cbab00d63a76a217a68332e5d40", + "requires": [ + "decision" + ] + }, + "original": { + "ref": "checkout:draft-acceptance-issue.original", + "revision": "sha256:ca10b80e39fe01a5ea57ccc6a3d834ec5f030f8cac79bc67f5ccd45cc1aa17ae" + } + }, + "routes": { + "navigation": { + "layer": "L0", + "required": [ + "navigation" + ] + }, + "decision": { + "layer": "L1", + "required": [ + "decision" + ] + }, + "procedure": { + "layer": "L2", + "required": [ + "procedure" + ] + }, + "originals": { + "layer": "L3", + "required": [ + "original" + ] + } + } + } + }, + "directory_resources": { + "workflows/governance/draft-acceptance-issue/SKILL.md": "original" + } +} diff --git a/src/inferrsi/knowledge/compositions/repository-evolution-analysis.json b/src/inferrsi/knowledge/compositions/repository-evolution-analysis.json new file mode 100644 index 000000000..1ff7e00ed --- /dev/null +++ b/src/inferrsi/knowledge/compositions/repository-evolution-analysis.json @@ -0,0 +1,248 @@ +{ + "authority": "checkout", + "metadata": { + "id": "repository-evolution-analysis", + "kind": "skill", + "entrypoint": "workflows/research/repository-evolution-analysis/SKILL.md", + "title": "Analyze a repository's commit history to build a capability-evolution model: what the system can do, how it got there, and what patterns allow it to iterate quickly. Use to produce history-derived knowledge for agent skill conditioning, and to design temporal-split benchmarks for skill evaluation.\n", + "origin": [ + "external" + ], + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/research/repository-evolution-analysis/SKILL.md", + "sha256": "0f48cc6a77b3ac861af698048be7c250c3ef5c225dc238b9a0e6d71208cbd93e" + }, + { + "url": "https://github.com/LearningToCommit/LearningToCommit", + "commit": "7e5a1d77", + "paths": [ + "data_construction/s1_scan_commits.py", + "data_construction/s3_tag.py", + "data_construction/s4_sample.py", + "data_construction/s5_build.py", + "modules/agent.py", + "modules/prompt_builder.py", + "modules/trajectory_to_md.py", + "system_prompts/solve_with_skill.txt", + "system_prompts/learn_reflect.txt", + "evaluation/pairwise_judge.py", + "evaluation/programmatic_metrics.py" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "77800032", + "paths": [ + "internal/", + "docs/" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "4b5d6d725fae3d8a263f6e43c707400e3765b84f", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go" + ], + "type": "git", + "revision_precision": "full" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "9848a9062a65c49e074c09770dc7de73dd012bea", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go", + "internal/library/rtk_path.go", + "internal/library/rtk_path_other.go", + "internal/library/rtk_path_windows.go", + "internal/library/rtk_path_test.go", + "internal/library/rtk_test.go", + "internal/library/rtk_upgrade_test.go", + "internal/library/library_test.go", + "internal/gui/library.go", + "internal/gui/assets/library.js", + "internal/gui/tests/library-rtk-path.test.cjs", + "library_cli.go", + "LICENSE" + ], + "type": "git", + "revision_precision": "full" + } + ], + "applicability": { + "scope": "any software repository with a recoverable git history", + "prerequisites": "git history access, optionally LearningToCommit-style benchmark for evaluation" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "The RTK transition is a learning example, not an independent heldout task; upstream tests were inspected, not executed.", + "Existing audit and synthetic KV comparison adapters are not a generic historical coding-task evaluator.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [ + { + "url": "https://github.com/LearningToCommit/LearningToCommit", + "commit": "7e5a1d77", + "paths": [ + "data_construction/s1_scan_commits.py", + "data_construction/s3_tag.py", + "data_construction/s4_sample.py", + "data_construction/s5_build.py", + "modules/agent.py", + "modules/prompt_builder.py", + "modules/trajectory_to_md.py", + "system_prompts/solve_with_skill.txt", + "system_prompts/learn_reflect.txt", + "evaluation/pairwise_judge.py", + "evaluation/programmatic_metrics.py" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "77800032", + "paths": [ + "internal/", + "docs/" + ], + "type": "git", + "revision_precision": "prefix" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "4b5d6d725fae3d8a263f6e43c707400e3765b84f", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go" + ], + "type": "git", + "revision_precision": "full" + }, + { + "url": "https://github.com/yetone/magpie", + "commit": "9848a9062a65c49e074c09770dc7de73dd012bea", + "paths": [ + "internal/library/rtk.go", + "internal/library/rtk_upgrade.go", + "internal/proc/path_other.go", + "internal/proc/path_windows.go", + "internal/provider/install_windows.go", + "internal/library/rtk_path.go", + "internal/library/rtk_path_other.go", + "internal/library/rtk_path_windows.go", + "internal/library/rtk_path_test.go", + "internal/library/rtk_test.go", + "internal/library/rtk_upgrade_test.go", + "internal/library/library_test.go", + "internal/gui/library.go", + "internal/gui/assets/library.js", + "internal/gui/tests/library-rtk-path.test.cjs", + "library_cli.go", + "LICENSE" + ], + "type": "git", + "revision_precision": "full" + } + ], + "empirical_validation": "not_run", + "required_resources": [ + "workflows/research/repository-evolution-analysis/SKILL.md", + "workflows/research/repository-evolution-analysis/references/capability-presence-audit.md", + "workflows/research/repository-evolution-analysis/references/rtk-consumer-path-transition.md" + ], + "composition": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "nodes": { + "navigation": { + "ref": "checkout:repository-evolution-analysis.original.navigation", + "revision": "sha256:48f8a7deca581aa6517f0ddb6b02ddbdc0562d34dc243aafa82201b0736b1003" + }, + "decision": { + "ref": "checkout:repository-evolution-analysis.original.decision", + "revision": "sha256:9eacf6c23770465c9997a3bbc2679bcb91db5385e2122c4db8dc2e064cb840e0" + }, + "procedure": { + "ref": "checkout:repository-evolution-analysis.original.procedure", + "revision": "sha256:9384f41bb56baf15ebc692a82cc6c6f754593e9c90d8d1230b354d23861e3e5b", + "requires": [ + "decision" + ] + }, + "original": { + "ref": "checkout:repository-evolution-analysis.original", + "revision": "sha256:cd610034cfb37c854ad70e2f16ab17d24511dfe018f9cd8787543984bd8c0106" + }, + "capability-presence-audit": { + "ref": "checkout:repository-evolution-analysis.capability-presence-audit", + "revision": "sha256:ce7271af12488bb77a2309c1ddff44567f06c1cf03b3458b3d2a7bab178efe6f" + }, + "rtk-consumer-path-transition": { + "ref": "checkout:repository-evolution-analysis.rtk-consumer-path-transition", + "revision": "sha256:8fa3a2be27eba6edc3260bd2ac977176cb7b5ed4d5a80119f8a4b06f630cbe1b" + } + }, + "routes": { + "navigation": { + "layer": "L0", + "required": [ + "navigation" + ] + }, + "decision": { + "layer": "L1", + "required": [ + "decision" + ] + }, + "procedure": { + "layer": "L2", + "required": [ + "procedure", + "rtk-consumer-path-transition" + ] + }, + "originals": { + "layer": "L3", + "required": [ + "original", + "capability-presence-audit", + "rtk-consumer-path-transition" + ] + } + } + } + }, + "directory_resources": { + "workflows/research/repository-evolution-analysis/SKILL.md": "original", + "workflows/research/repository-evolution-analysis/references/capability-presence-audit.md": "capability-presence-audit", + "workflows/research/repository-evolution-analysis/references/rtk-consumer-path-transition.md": "rtk-consumer-path-transition" + } +} diff --git a/src/inferrsi/knowledge/compositions/rsi-evidence.json b/src/inferrsi/knowledge/compositions/rsi-evidence.json new file mode 100644 index 000000000..7131076e9 --- /dev/null +++ b/src/inferrsi/knowledge/compositions/rsi-evidence.json @@ -0,0 +1,168 @@ +{ + "authority": "checkout", + "metadata": { + "id": "rsi-evidence", + "kind": "skill", + "entrypoint": "workflows/governance/rsi-evidence/SKILL.md", + "title": "Guide agents to establish acceptance criteria, freeze and cite RSI evidence using plan/results/patch/validator paths and PASS/FAIL/INCONCLUSIVE verdicts.", + "origin": [ + "first-party" + ], + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/governance/rsi-evidence/SKILL.md", + "sha256": "5edd2bd544da050d2688f37c85ae6e7927eaee24af764e3c96b6cec04982990a" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "applicability": { + "scope": "Preparing acceptance criteria, documenting or reviewing an optimization campaign whose verdict will be cited downstream", + "prerequisites": "For preparation, the user requirements and available model/hardware/workload evidence; for verdicts, pinned baseline and candidate SHAs and an evidence tree under evidence//; conclusions about LoopX goal authority additionally need its governance reference", + "input_contract": "Campaign artifacts in plan/, results/, patch/ and validator/, plus the RunSpec that fixes repo x revision x backend x device x model x scenario", + "produced_artifact": "An evidence record that links paths instead of pasting metrics, and states exactly one of PASS, FAIL or INCONCLUSIVE with its rationale", + "failure_modes": [ + "Metrics pasted into an issue comment with no link to an evidence path", + "A verdict vocabulary outside PASS/FAIL/INCONCLUSIVE", + "PASS recorded on a cleanup or integrity-probe failure", + "Output reused across trials, aliased into a reference, or written outside its own trial directory", + "Source fingerprint taken over a directory overlap that excludes changed tracked files", + "Org-wide default SHAs assumed in a skill or CI instead of read from the acceptance issue" + ], + "refusal_point": "Refuses PASS when the validator freeze, the results rationale or the pinned SHAs are missing, and reports INCONCLUSIVE for that campaign instead" + }, + "state": "candidate", + "limitations": [ + "Documents evidence discipline; it performs no measurement and certifies no campaign.", + "The LoopX goal-governance reference is a source-derived candidate and adds no execution permission or empirical validation.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "required_resources": [ + "workflows/governance/rsi-evidence/SKILL.md", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/LICENSE", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/LICENSE-MIT.md", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/NOTICE.md", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/README.md", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/decision-cases.md", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/mechanisms.md", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/source-ledger.json", + "workflows/governance/rsi-evidence/references/omni-experiments.md" + ], + "composition": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "nodes": { + "navigation": { + "ref": "checkout:rsi-evidence.original.navigation", + "revision": "sha256:600c6680f42d521eee9727f7aea197b6be3d669ae7e96337b5dcd45f7190079a" + }, + "decision": { + "ref": "checkout:rsi-evidence.original.decision", + "revision": "sha256:e6dfa4f199733096bddec10f7024c25c0b030065c09a21cb970653150abc4e0b" + }, + "procedure": { + "ref": "checkout:rsi-evidence.original.procedure", + "revision": "sha256:5d9ccfa49ac55d3855b7c6af41142be3371c57f7e72602217eb8b6efb4164307", + "requires": [ + "decision" + ] + }, + "original": { + "ref": "checkout:rsi-evidence.original", + "revision": "sha256:8f1f5835e75528adc8668a3b114b23b4270fb40e6deea596eb68dc8de8018df7" + }, + "license": { + "ref": "checkout:rsi-evidence.license", + "revision": "sha256:9e9faea75bf047ee5bbf25c0ba4d98c624d293425c54015b8f25969d9ea82e1a" + }, + "license-mit": { + "ref": "checkout:rsi-evidence.license-mit", + "revision": "sha256:21f15fa81cb5c361df0046d879f9615a2b5bb279c5be2e347662817cb60ad6e7" + }, + "notice": { + "ref": "checkout:rsi-evidence.notice", + "revision": "sha256:e8996f7f4f4b0280ae9c18f122fbd8534fca62a805577602622bf86586b153b7" + }, + "readme": { + "ref": "checkout:rsi-evidence.readme", + "revision": "sha256:e875756b5c56185ee85aeaa47efa830c7d2bdbd8703367a955b65dc68e4696e5" + }, + "decision-cases": { + "ref": "checkout:rsi-evidence.decision-cases", + "revision": "sha256:49e195212a299d9551a4d13b6d6ff6455d2b05053181ce491d0bb5de8f7389b7" + }, + "mechanisms": { + "ref": "checkout:rsi-evidence.mechanisms", + "revision": "sha256:77f19cd5b5c1888471a31080c45cf465ae6907f054dcf1f209ea5545bbbb6d9f" + }, + "source-ledger": { + "ref": "checkout:rsi-evidence.source-ledger", + "revision": "sha256:e5b5ffda7a73de20b30593ec591922b3f2f579cb9bb0e569488b0d5bb35d56b6" + }, + "omni-experiments": { + "ref": "checkout:rsi-evidence.omni-experiments", + "revision": "sha256:d9a3e28875876aa26b0d66700ddf9455b00807c9bb38b362eb33b173f1b79980" + } + }, + "routes": { + "navigation": { + "layer": "L0", + "required": [ + "navigation" + ] + }, + "decision": { + "layer": "L1", + "required": [ + "decision" + ] + }, + "procedure": { + "layer": "L2", + "required": [ + "procedure" + ] + }, + "originals": { + "layer": "L3", + "required": [ + "original", + "license", + "license-mit", + "notice", + "readme", + "decision-cases", + "mechanisms", + "source-ledger", + "omni-experiments" + ] + } + } + } + }, + "directory_resources": { + "workflows/governance/rsi-evidence/SKILL.md": "original", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/LICENSE": "license", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/LICENSE-MIT.md": "license-mit", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/NOTICE.md": "notice", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/README.md": "readme", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/decision-cases.md": "decision-cases", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/mechanisms.md": "mechanisms", + "workflows/governance/rsi-evidence/references/loopx-goal-governance/source-ledger.json": "source-ledger", + "workflows/governance/rsi-evidence/references/omni-experiments.md": "omni-experiments" + } +} diff --git a/src/inferrsi/knowledge/compositions/skill-evolution-playbook.json b/src/inferrsi/knowledge/compositions/skill-evolution-playbook.json new file mode 100644 index 000000000..16df171ba --- /dev/null +++ b/src/inferrsi/knowledge/compositions/skill-evolution-playbook.json @@ -0,0 +1,113 @@ +{ + "authority": "checkout", + "metadata": { + "id": "skill-evolution-playbook", + "kind": "skill", + "entrypoint": "workflows/maintenance/skill-evolution-playbook/SKILL.md", + "title": "Practical design choices for evolving agent skills from execution traces: when one trajectory should update a skill, how conflicting lessons are handled, how negative evidence is preserved, how large an edit should be, and when skills should split or merge. Drawn from Trace2Skill and SkillOpt. Use when designing or operating a skill evolution pipeline.\n", + "origin": [ + "external" + ], + "sources": [ + { + "type": "git", + "repo": "https://github.com/InferMatrixLab/InferRSI", + "commit": "e2f3be102c66c358803ed2186ed67bf627ebcbdf", + "path": "src/inferrsi/knowledge/data/skill_library/workflows/maintenance/skill-evolution-playbook/SKILL.md", + "sha256": "f988a0569be93fec550da52484d22d970b0a6c31394ea463ad6ee40e0877ede6" + }, + { + "type": "unknown", + "note": "Legacy provenance remains in procedure/readsets" + } + ], + "applicability": { + "scope": "Design choices for evolving agent skills from execution traces, drawn from Trace2Skill and SkillOpt: when a trajectory should update a skill, how conflicting lessons are handled, how negative evidence is preserved, how large an edit should be and when skills split or merge; for designing or operating a skill evolution pipeline", + "prerequisites": "A final-test partition kept outside edit selection and the incumbent skill retained for rollback; changing a skill's scope first needs explicit review of its identity and consumers", + "input_contract": "Execution trajectories or trace IDs with the diagnosed causal failure and the successful behavior an amendment must preserve; the incumbent skill and its revision lineage; held-out evaluation results for candidate edits", + "produced_artifact": "A scoped case or amendment proposal, or a consolidated candidate edit, with rejection records and the versioned revision lineage; a candidate for independently evaluated acceptance, not a replacement decision or an efficacy claim", + "failure_modes": [ + "An anecdote, or agreement among analysts, is taken as efficacy", + "Consolidation output is treated as a replacement decision instead of a candidate awaiting independent acceptance", + "A tie or uncertain result is reported as improvement", + "A conflict is resolved by voting for whichever outcome appeared more often in the pool", + "A rejection is applied to every future use of an idea instead of the comparison it constrains", + "Paper-specific section counts or length budgets are used as universal defaults, or a skill is split on length alone", + "A stronger task solver is assumed to be a stronger improver, or replay rankings and private inner scores are read as outer generalization" + ], + "refusal_point": "Records a conflict that conditioning cannot resolve, where the same context produces different outcomes across runs, as INCONCLUSIVE and flags it for human review instead of choosing a lesson; claims no universal minimum trace count, paper-to-code equivalence or local efficacy" + }, + "state": "candidate", + "limitations": [ + "Source-derived candidate; no local efficacy validation.", + "Original typed source inventory is not normalized; retain source identities and limits in the procedure/readsets.", + "Checkout-only local skill; no automatic execution or promotion.", + "Only declared references are required; other cross-skill links are navigation.", + "Historical revisions require a matching checkout or a retained store." + ], + "attribution": [], + "empirical_validation": "not_run", + "required_resources": [ + "workflows/maintenance/skill-evolution-playbook/SKILL.md" + ], + "composition": { + "when": {}, + "license": "Apache-2.0", + "permissions": { + "read": true, + "retain": true, + "redistribute": true + }, + "nodes": { + "navigation": { + "ref": "checkout:skill-evolution-playbook.original.navigation", + "revision": "sha256:71c75dd0054b9ae8dfc152c1104c992a6a398d52c8d2d6b3eee84cf8ad1e97d4" + }, + "decision": { + "ref": "checkout:skill-evolution-playbook.original.decision", + "revision": "sha256:72c952b6f4153775d65cda7160a153ee00c449c0049bd6d8d535f5c6f704b769" + }, + "procedure": { + "ref": "checkout:skill-evolution-playbook.original.procedure", + "revision": "sha256:1bb67a476f20d6d15675bc24088a780b79e0c2a9e96e28885c0af86af11e5d93", + "requires": [ + "decision" + ] + }, + "original": { + "ref": "checkout:skill-evolution-playbook.original", + "revision": "sha256:c527116d08710c491fdcb143dbfcb3615b3857255c76c58d9287b56349bd749d" + } + }, + "routes": { + "navigation": { + "layer": "L0", + "required": [ + "navigation" + ] + }, + "decision": { + "layer": "L1", + "required": [ + "decision" + ] + }, + "procedure": { + "layer": "L2", + "required": [ + "procedure" + ] + }, + "originals": { + "layer": "L3", + "required": [ + "original" + ] + } + } + } + }, + "directory_resources": { + "workflows/maintenance/skill-evolution-playbook/SKILL.md": "original" + } +} diff --git a/tests/knowledge/test_atomic_workflows.py b/tests/knowledge/test_atomic_workflows.py index 7420cdd7b..02b49f6eb 100644 --- a/tests/knowledge/test_atomic_workflows.py +++ b/tests/knowledge/test_atomic_workflows.py @@ -11,23 +11,23 @@ from inferrsi.knowledge.catalog import _skill_search_source from inferrsi.knowledge.decision_cards import DecisionSource from tests.knowledge.test_atomic_casebooks import assert_empty, canonical, digest, select -from tests.knowledge.test_atomic_generation import RELEASE_ROOT, make_author_root +from tests.knowledge.test_atomic_generation import RELEASE_ROOT, make_author_root, write_json from tests.knowledge.test_atomic_reader import allow FIXTURE = Path(__file__).resolve().parents[1] / "fixtures/atomic-reader/workflow-domain-v0.3.4.json" RELEASE = json.loads(FIXTURE.read_bytes()) KNOWLEDGE = FIXTURE.parents[3] / "src/inferrsi/knowledge" GUIDES = ("cite-check-downstream-pr", "claim-contract", "competitor-scan", "npu-skill-factory") +LINKED_GUIDES = ("draft-acceptance-issue", "repository-evolution-analysis", "rsi-evidence", + "skill-evolution-playbook") LIBRARY = "src/inferrsi/knowledge/data/skill_library/" -@pytest.fixture(scope="module") -def workflow_installation(tmp_path_factory): - root = tmp_path_factory.mktemp("workflows") +def workflow_sources(root, names): author = make_author_root(root) pinned = root / "release" shutil.copytree(RELEASE_ROOT, pinned) - for name in GUIDES: + for name in names: row = RELEASE["refs"]["checkout:" + name] composition = Path("compositions", name + ".json") shutil.copyfile(KNOWLEDGE / composition, author / composition) @@ -50,28 +50,38 @@ def workflow_installation(tmp_path_factory): original = pinned / (LIBRARY + path) original.parent.mkdir(parents=True, exist_ok=True) original.write_bytes(data) + return author, pinned + + +@pytest.fixture(scope="module") +def workflow_installation(tmp_path_factory): + root = tmp_path_factory.mktemp("workflows") + author, pinned = workflow_sources(root, (*GUIDES, *LINKED_GUIDES)) target = root / "installed" generation = build_generation(author, target, permits=allow, source_roots={RELEASE["source_commit"]: pinned}) return InstalledGeneration(target, expected=generation), target -@pytest.mark.parametrize("name", GUIDES) -def test_checkout_host_and_layered_selection_preserve_workflow_guide(workflow_installation, name): +@pytest.mark.parametrize("name", (*GUIDES, *LINKED_GUIDES)) +def test_checkout_layered_selection_preserves_workflow_guide(workflow_installation, name): installed, target = workflow_installation ref = "checkout:" + name row = RELEASE["refs"][ref] guide = row["entry_source"] - assert installed.skills[name] == ref revision = installed.catalog[ref]["revision"] _, bundle = installed.read_resolved(ref, revision=revision) - host = target / "skills" / name - raw = (host / "SKILL.md").read_bytes() - directory = PurePosixPath(guide).parent - files = {(directory / p.relative_to(host).as_posix()).as_posix(): p.read_bytes() - for p in host.rglob("*") if p.is_file()} + files = bundle.content + raw = files[guide] assert {path: digest(data) for path, data in files.items()} == row["required_resources"] - assert bundle.content == files and bundle.dependencies == row["dependencies"] == {} + assert bundle.dependencies == row["dependencies"] + if name in GUIDES or name in installed.skills: + assert installed.skills[name] == ref + host = target / "skills" / name + directory = PurePosixPath(guide).parent + exported = {(directory / p.relative_to(host).as_posix()).as_posix(): p.read_bytes() + for p in host.rglob("*") if p.is_file()} + assert exported == files assert bundle.metadata["required_resources"] == sorted(files) assert digest(raw) == row["entry_sha256"] == row["guide_sha256"] assert digest(canonical(bundle.view()["resources"])) == row["resource_set"] @@ -93,7 +103,9 @@ def test_checkout_host_and_layered_selection_preserve_workflow_guide(workflow_in assert item["source"]["commit"] == RELEASE["source_commit"] path = item["source_path"].removeprefix(LIBRARY) assert item["source_path"] == LIBRARY + path - if layer != "L3": + if layer == "L2": + assert path == guide or path in row["dependencies"] + elif layer != "L3": assert path == guide assert item["source_range_verification"] == "verified_at_build" assert body == files[path][lo:hi] and digest(body) == item["source_sha256"] @@ -115,8 +127,12 @@ def test_checkout_host_and_layered_selection_preserve_workflow_guide(workflow_in assert digest(canonical(compared)) == row["card_sha256"] assert len(canonical(compared)) == row["card_bytes"] assert compared["status"] == row["status"] == "partial" - assert compared["missing_fields"] == row["missing_fields"] == ["validation"] - assert results["L2"][0] == decision and b"".join(results["L2"]) == raw + assert compared["missing_fields"] == row["missing_fields"] + assert "validation" in compared["missing_fields"] + assert results["L2"][0] == decision and b"".join(results["L2"][:2]) == raw + assert results["L2"][2:] == tuple(files[path] for path in row["dependencies"]) + for path, revision in row["dependencies"].items(): + assert revision == "sha256:" + digest(files[path]) assert results["L3"] == tuple(files[path] for path in sorted(files)) @@ -168,3 +184,80 @@ def test_package_baseline_has_its_own_card_and_shared_dependency(workflow_instal assert row["card_sha256"] != checkout["card_sha256"] short = old.project(max_bytes=row["card_bytes"] - 1) assert short["status"] == "over_budget" and "card" not in short + + +def test_loopx_originals_keep_upstream_terms_and_attribution(workflow_installation): + installed, _ = workflow_installation + ref = "checkout:rsi-evidence" + _, bundle = installed.read_resolved(ref, revision=installed.catalog[ref]["revision"]) + ledger_path = next(path for path in bundle.content if path.endswith("/source-ledger.json")) + ledger = json.loads(bundle.content[ledger_path]) + assert ledger["source"]["license"] == "Apache-2.0" + assert ledger["source"]["commit"] == "f094b2cfb2acde7a4a0d4d875bba52f64ac31ba9" + originals = {row["resource"]: row for row in ledger["preserved_originals"]} + assert originals.keys() == {"LICENSE", "LICENSE-MIT.md", "NOTICE.md"} + directory = PurePosixPath(ledger_path).parent + attached = {p: body for p, body in bundle.content.items() + if PurePosixPath(p).parent == directory} + assert len(attached) == 7 + for path, body in attached.items(): + filename = PurePosixPath(path) + atom_ref = ref + "." + filename.stem.lower() + revision = installed.catalog[atom_ref]["revision"] + _, atom = installed.read_resolved(atom_ref, revision=revision) + credit, = atom.metadata["attribution"] + assert credit["url"] == ledger["source"]["url"] + assert credit["commit"] == ledger["source"]["commit"] + assert credit in atom.metadata["sources"] + assert atom.metadata["empirical_validation"] == "not_run" + assert dict(atom.content) == {filename.name: body} + expected_license = "MIT" if filename.name == "LICENSE-MIT.md" else "Apache-2.0" + assert atom.metadata["atom"]["license"] == expected_license + if filename.name in originals: + old = originals[filename.name] + assert credit["path"] == old["source_path"] + assert credit["sha256"] == old["sha256"] == digest(body) + assert len(body) == old["bytes"] + + +@pytest.mark.parametrize(("change", "error"), [ + ("missing required guide", "L2 must deliver"), ("optional guide", "unconditional delivery"), + ("different attachment", "L2 must deliver"), ("undeclared extra", "L2 must deliver"), + ("unbound checkout", "requires checked"), ("unbound navigation", "requires checked"), + ("invented dependency revision", "source-declared dependencies"), + ("remove resource", "complete original directory"), +]) +def test_checkout_requires_the_released_dependency(tmp_path, change, error): + name = "repository-evolution-analysis" + author, pinned = workflow_sources(tmp_path, [name]) + path = author / "compositions" / (name + ".json") + spec = json.loads(path.read_bytes()) + meta = spec["metadata"] + route = meta["composition"]["routes"]["procedure"] + attachment = "rtk-consumer-path-transition" + original = next(p for p, node in spec["directory_resources"].items() if node == attachment) + if change == "missing required guide": + route["required"].remove(attachment) + elif change == "optional guide": + route["required"].remove(attachment) + route["optional"] = [attachment] + elif change == "different attachment": + route["required"] = ["procedure", "capability-presence-audit"] + elif change == "undeclared extra": + route["required"].append("capability-presence-audit") + elif change.startswith("unbound"): + del spec["directory_resources"] + if change == "unbound navigation": + del meta["entrypoint"] + del meta["required_resources"] + elif change == "invented dependency revision": + spec["dependencies"] = {original: "sha256:" + "0" * 64} + else: + del spec["directory_resources"][original] + meta["required_resources"].remove(original) + write_json(path, spec) + target = tmp_path / "installed" + with pytest.raises(ValueError, match=error): + build_generation(author, target, permits=allow, + source_roots={RELEASE["source_commit"]: pinned}) + assert not target.exists()