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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 17 additions & 30 deletions plugins/inferrsi/skills/inferrsi/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,28 +149,13 @@ both AB/BA and service reuse. Show the approved score scale and, for a service
baseline tolerance on percent scores, the allowed difference in percentage points.
This command uses the same Harness controller as the packaged task path below.

Edit the returned working candidate. Submit each hypothesis and candidate with
`session round`, read the feedback, and keep failed attempts. Retrieve needed
knowledge with `find "<question>" --session <dir>` when the frozen condition
allows it. Follow a hit's scoped `read` command to receive its body and a
round receipt. Use a pinned `read --resource` for a particular attachment.
If a read returns `next_read_args`, run those arguments to continue the same
resource, revision and search. Read all needed pages before treating a file as
fully received; each receipt records only its returned bytes.
When a passage you read changes the candidate or check you choose, explain
that choice in the existing `--hypothesis` and append
`[use REF | EXACT SOURCE EXCERPT]`. Use the read result's material `ref`
and a verbatim passage on one line. Leave the reason without a citation
when reading did not affect it.
For a Codex rollout, record the line boundary in its own tool call before
retrieval. Run each Find and each emitted `read_args` as a simple command in
its own tool call. Keep the full output visible. At round close, import both
receipts and the round response as described in
[Record research and campaign evidence](references/evidence-and-attribution.md).
If a submitted AB/BA round finished asynchronously and its response was clipped,
run `session status --session <dir> --round-receipt <round>` after completion
and include its short return in the same import window. A benchmark uses
`session status` with the same options.
Edit the returned working candidate. For a Codex rollout, record the round's
starting line in a separate tool call before the first `find`. When the frozen
knowledge condition allows retrieval, follow the
[managed-round evidence workflow](references/evidence-and-attribution.md#for-managed-rounds).
Submit each hypothesis and candidate with `session round`, read the feedback,
and keep failed attempts. For a Codex rollout, close the search archive after
each round using the linked import procedure.
Profiling and new knowledge queries are driven by the current problem, not
mandatory every round. Use `up_to` for a declared round limit or `exact` for fixed
rounds. End an up-to search with `session final --reason <why>`; it retests the
Expand Down Expand Up @@ -212,15 +197,17 @@ In the execution conversation, use `session --help` through
the selected runtime. The first iterative task is `qwen21-denoise-npu`.
Start a new session with the user's round/time budget, condition label,
evaluation prefix and sampling arguments. Read its returned frozen TASK.md and
edit the returned working candidate. When knowledge is permitted, retrieve it
with `find "<question>" --session <dir>` and follow the selected hit's scoped
`read` command. When the benchmark supplies a required delivery, run its frozen
Find request and read the named card before submitting the first round. Submit each changed
edit the returned working candidate. For a Codex rollout, record the round's
starting line in a separate tool call before the first `find`. When the frozen
knowledge condition allows retrieval, follow the
[managed-round evidence workflow](references/evidence-and-attribution.md#for-managed-rounds).
When the benchmark supplies a required delivery, run its frozen Find request
and read the named card before submitting the first round. Submit each changed
candidate and hypothesis with `session round`, then inspect the independent
feedback before the next change. Use the same conditional `[use REF | EXACT SOURCE EXCERPT]`
in the hypothesis and close the Codex search archive as in `session round`.
Keep failed rounds. Complete the frozen budget
and use `session final` for independent retesting. Report `summary.json` and its
feedback before the next change. For a Codex rollout, close the search archive
after each round using the linked import procedure. Keep failed rounds.
Complete the frozen budget and use `session final` for independent retesting.
Report `summary.json` and its
per-round curve data. Import actual usage exports when available and preserve
unknown values. Use `session recover` to collect an interrupted existing attempt.
The current host Agent drives these operations. `benchmarks run` evaluates one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ available. If the context or reasoning was not captured, state that it is
missing instead of inferring it from a verdict. The optional campaign trace
format and association workflow are documented in `docs/dashboard.md`.

For managed rounds, Find records the returned hits. Following a hit's scoped
`read` command records the material delivered. In an AB/BA project or a
benchmark, pass a used read's `reference.path` to `round --knowledge-ref`.
A service-reuse attempt retains prepared contexts automatically. Record what
influenced the change in the hypothesis. For a manual campaign, use
`find "<question>" --session <dir>` and the returned read
For a manual campaign, use `find "<question>" --session <dir>` and the returned read
command. After each manual round, use `evidence log` to record the
hypothesis, why this optimization was chosen, which
knowledge it relied on, the search options tried, pruned or left untried and
Expand Down Expand Up @@ -54,3 +49,35 @@ benchmark and quality descriptions. Supply it to `dashboard --translations` as
documented in `docs/dashboard.md`. Keep the recorded context, commands and
identifiers intact; a translation is not the original evidence. Explicitly leave
unsupported or unavailable translations in their original language.

#### For managed rounds

Use `find "<question>" --session <dir>` when the frozen knowledge condition
allows retrieval. Find records the returned hits. Follow the selected hit's
scoped `read` command to receive the material and its delivery receipt. Use a
pinned `read --resource` for a particular attachment. If the result includes
`next_read_args`, run those arguments to continue the same resource, revision
and search. Each receipt covers the bytes returned on that page. Read all
needed pages before treating a file as fully received.

For an AB/BA project or a packaged benchmark, pass the used read's
`reference.path` with `session round --knowledge-ref`. A service-reuse
attempt retains prepared contexts automatically. If a passage influences
the candidate or check, explain the choice in `--hypothesis` and append
`[use REF | EXACT SOURCE EXCERPT]` on one line, with the read result's
material `ref` and a verbatim excerpt. When the read had no effect on the
choice, record the reason alone.

For a Codex rollout, record the start line in a separate tool call before the
first `find`. Run each Find and each returned `read_args` or `next_read_args`
as a simple command in its own tool call, with the full output visible.
After an asynchronous AB/BA or benchmark round completes with a clipped
response, run `session status --session <dir> --round-receipt <round>`.
Include the original round call, the status call and its return in the same
import window.

At round close, wait for the round response or short receipt to appear in the
rollout. Run `evidence import-search` with the inclusive line range, the corpus
root and the standard Find and read capture IDs as described above.
See [Import one round's searches](https://github.com/InferMatrixLab/InferRSI/blob/main/docs/dashboard.md#import-one-rounds-searches)
for the command and how to verify the saved passages and citations.
13 changes: 2 additions & 11 deletions tests/apps/test_antigravity_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import json
import os
import re
import shutil
import subprocess
import sys
Expand All @@ -13,6 +12,7 @@

import pytest

from tests.fixtures.plugin_references import assert_packaged_skill_references
from tools.build_antigravity_plugin import MAX_SKILL_BODY_BYTES, build_plugin
from tools.plugin_bundle import PROJECT, _io_path

Expand Down Expand Up @@ -79,16 +79,7 @@ def test_antigravity_plugin_bundle_layout_and_manifest(tmp_path):
archive.extractall(extracted)

plugin = extracted / "inferrsi"
entry_skill = plugin / "skills/inferrsi/SKILL.md"
raw_entry = entry_skill.read_bytes()
raw_parts = raw_entry.split(b"---", 2)
raw_body = raw_parts[2].lstrip(b"\r\n") if len(raw_parts) == 3 else raw_entry
assert len(raw_body) <= MAX_SKILL_BODY_BYTES
for rel_link in set(re.findall(
r"\]\((references/[^)#\s]+)\)",
entry_skill.read_text(encoding="utf-8"),
)):
assert (entry_skill.parent / rel_link).is_file()
assert_packaged_skill_references(plugin / "skills/inferrsi")
metadata = json.loads((plugin / "plugin.json").read_text(encoding="utf-8"))
assert set(metadata) <= ALLOWED_PLUGIN_JSON_KEYS
assert metadata["name"] == "inferrsi"
Expand Down
6 changes: 6 additions & 0 deletions tests/apps/test_codex_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from tests.apps import test_project_optimization
from tests.fixtures.campaign_intake import write_start_record
from tests.fixtures.diagnosis import diagnosis_args
from tests.fixtures.plugin_references import assert_packaged_skill_references
from tools.build_codex_plugin import build_plugin
from tools.build_workswarm_plugin import build_plugin as build_workswarm_plugin
from tools.check_release import check_plugin
Expand Down Expand Up @@ -262,6 +263,11 @@ def test_isolated_runtime_and_exact_knowledge_reads(distribution, tmp_path):
assert "unavailable" in stale.stderr


@pytest.mark.parametrize("distribution", ["codex"], indirect=True)
def test_codex_bundle_includes_managed_round_evidence(distribution):
assert_packaged_skill_references(distribution / "skills/inferrsi")


def test_entry_loads_the_required_primary_before_search(distribution, tmp_path):
entry = (distribution / "skills/inferrsi/SKILL.md").read_text(encoding="utf-8")
# Inspect the actual distributed entry, including the instructions before the
Expand Down
8 changes: 2 additions & 6 deletions tests/apps/test_dsh_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import io
import json
import os
import re
import shutil
import subprocess
import sys
Expand All @@ -16,6 +15,7 @@

from tests.apps.test_project_optimization import project, start_arguments # noqa: F401
from tests.fixtures.campaign_intake import approved_start
from tests.fixtures.plugin_references import assert_packaged_skill_references
from tools.build_dsh_plugin import build_bundle
from tools.plugin_bundle import PROJECT, _io_path

Expand Down Expand Up @@ -62,11 +62,7 @@ def test_manual_bundle_runs_from_an_external_workspace(tmp_path, project): # no
assert (skill / relative).read_bytes() == (shared_skill / relative).read_bytes()
for ref_file in (shared_skill / "references").glob("*.md"):
assert (skill / "references" / ref_file.name).read_bytes() == ref_file.read_bytes()
for rel_link in set(re.findall(
r"\]\((references/[^)#\s]+)\)",
(skill / "SKILL.md").read_text(encoding="utf-8"),
)):
assert (skill / rel_link).is_file()
assert_packaged_skill_references(skill)
guide = PROJECT / "docs/dashboard.md"
assert (skill / "docs/dashboard.md").read_bytes() == guide.read_bytes()

Expand Down
54 changes: 54 additions & 0 deletions tests/fixtures/plugin_references.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""Check the canonical skill and its reference links in an extracted bundle."""

import re
from pathlib import Path

from tools.build_antigravity_plugin import MAX_SKILL_BODY_BYTES, _skill_body_bytes

MANAGED_ROUND_REFERENCE = "references/evidence-and-attribution.md"
MANAGED_ROUND_LINK = f"]({MANAGED_ROUND_REFERENCE}#for-managed-rounds)"
PROJECT_ROUTE = "Optimize an ordinary user project"
BENCHMARK_ROUTE = "Complete an optimization task benchmark"


def assert_packaged_skill_references(skill: Path) -> None:
entry_file = skill / "SKILL.md"
entry = entry_file.read_text(encoding="utf-8")
assert _skill_body_bytes(entry_file) <= MAX_SKILL_BODY_BYTES
for relative in sorted(set(re.findall(r"\]\((references/[^)#\s]+)(?:#[^)\s]+)?\)", entry))):
assert (skill / relative).is_file(), f"Missing packaged reference: {relative}"

sections = {
title: " ".join(body.split())
for title, body in re.findall(r"^## ([^\n]+)\n(.*?)(?=^## |\Z)", entry, re.M | re.S)
}
for route in (PROJECT_ROUTE, BENCHMARK_ROUTE):
before_link, link, after_link = sections[route].partition(MANAGED_ROUND_LINK)
assert link, f"{route} must link to the managed-round section"
assert "separate tool call before the first `find`" in before_link
assert "frozen knowledge condition allows retrieval" in before_link
_, submission, after_round = after_link.partition("with `session round`")
assert submission, f"{route} must submit a round after the evidence link"
assert "close the search archive after each round" in after_round, route

before_round = sections[BENCHMARK_ROUTE].split("with `session round`", 1)[0]
assert (
"run its frozen Find request and read the named card before submitting the first round"
in before_round
)

reference = (skill / MANAGED_ROUND_REFERENCE).read_text(encoding="utf-8")
_, heading, managed_round = reference.partition("\n#### For managed rounds\n")
assert heading, "The packaged evidence reference must resolve #for-managed-rounds"
managed_round = managed_round.split("\n#### ", 1)[0]
for instruction in (
"`next_read_args`",
"`reference.path`",
"`session round --knowledge-ref`",
"`[use REF | EXACT SOURCE EXCERPT]`",
"`session status --session <dir> --round-receipt <round>`",
"`evidence import-search`",
"](https://github.com/InferMatrixLab/InferRSI/blob/main/docs/dashboard.md"
"#import-one-rounds-searches)",
):
assert instruction in managed_round, f"Missing managed-round instruction: {instruction}"
Loading