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
1 change: 1 addition & 0 deletions docs/apps-module-migrations.json
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@
"docs/guides/operations.md",
"src/inferrsi/apps/cli/__init__.py",
"src/inferrsi/apps/workflows/campaign.py",
"src/inferrsi/apps/workflows/indexer_comparison.py",
"src/inferrsi/apps/workflows/session_knowledge.py",
"tests/apps/test_apps_context_provider.py",
"tests/apps/test_apps_knowledge.py",
Expand Down
1 change: 1 addition & 0 deletions docs/guides/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ See [round decisions](knowledge/knowledge-retrieval-trace.md#round-decisions).
| Intent | Entry | Effect class | Boundary |
| --- | --- | --- | --- |
| Verify whether RSI knowledge improves optimization efficiency | CLI `benchmarks compare`; [comparison workflow](../benchmarks/benchmark-comparison.md) | Local experiment records / explicit native handoff / report-generating | Apps freezes two-task on/off plans, returns host actions, verifies retained finals and reports Benchmark comparisons; no hidden Agent launch |
| Compare two Indexer ranking rules on CPU | CLI `benchmarks indexer-compare`; Python `apps.workflows.indexer_comparison.compare_indexer_policies` | Read-only (optional new JSON report via `--output`) | Deterministic CPU retrieval and byte-budgeted delivery comparison over a pinned corpus and frozen query suite; enforces split isolation and optional `RankingSpace` checks; descriptive offline retrieval only, never a task or service `PASS` |
| Complete a task optimization in the current Agent | CLI `session start benchmark/round/status/final/recover`, `find --session` / `read` | Experiment-executing / local records | Frozen budget, actual candidates and independent task outcomes. The current Agent drives edits. Real usage is imported explicitly. Recovery collects an existing execution using its [pinned runtime](optimization-workflow-unification.md#release-boundary-recovery) |
| Optimize an ordinary project in the current Agent | CLI `session start project --reference-guard <json>`, then `baseline/diagnose/round/status/final/recover` | Experiment-executing / local records | The default measures A once per reference epoch, then measures candidates in order. Use `--comparison abba` for paired samples. See [shared workflow](optimization-workflow-unification.md) |
| Reuse one project service across multi-scenario checks | CLI `session start project --evaluation-config <json>`, then `baseline/round/profile/status/recover/final` | Experiment-executing / local records | The evaluation config contains the explicit reference guard and service commands. `refresh-references --drift` resets stale references after verified cleanup. See [service reuse](service-reuse-campaigns.md) |
Expand Down
5 changes: 5 additions & 0 deletions src/inferrsi/apps/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,11 @@ def main(

_print(compare_command(args))
return 0
if args.benchmark_action == "indexer-compare":
from ..workflows.indexer_comparison import indexer_compare_command

_print(indexer_compare_command(args, bundled_seal=bundled_seal))
return 0
if args.benchmark_action == "session":
return _session_command(args)
if args.benchmark_action == "external":
Expand Down
69 changes: 69 additions & 0 deletions src/inferrsi/apps/cli/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@
from ...knowledge.catalog import BACKENDS, KNOWLEDGE_REPOS, KNOWLEDGE_SCOPES, REPO_TYPES
from .task_input import FIELDS as TASK_FIELDS

# Mirror benchmark.indexer_comparison.INDEXER_METRICS here so parser() stays free
# of Benchmark imports during ordinary project-optimization CLI execution.
_INDEXER_METRICS = (
"delivery_rate",
"hit_at_1",
"hit_at_k",
"mrr_at_k",
"complete_delivery_rate",
)


def _final_score(value: str) -> int | float:
try:
Expand Down Expand Up @@ -689,6 +699,65 @@ def parser(*, parser_class=argparse.ArgumentParser, historical=False,
compare.add_argument("--session-id")
compare.add_argument("--receipt", type=Path, help="Original host creation receipt for bind")
compare.add_argument("--observation", type=Path, help="Native host observation JSON")
from ...knowledge.ranking_policy import MANAGED_RANKING_POLICIES

indexer_compare = actions.add_parser(
"indexer-compare",
help="Compare two Indexer ranking policies on CPU over a frozen query suite",
description=(
"Deterministic CPU retrieval and byte-budgeted delivery comparison between "
"a baseline and candidate RankingPolicy over a pinned Knowledge corpus and "
"frozen query suite. Reports descriptive offline retrieval metrics only; "
"establishes no optimization task gain or service-level PASS."
),
)
indexer_compare.add_argument(
"--queries", type=Path, required=True,
help="Frozen schema v1 query suite JSON file",
)
baseline_rule = indexer_compare.add_mutually_exclusive_group()
baseline_rule.add_argument(
"--baseline", choices=tuple(MANAGED_RANKING_POLICIES), default="default",
help="Registered baseline ranking policy (default: default)",
)
baseline_rule.add_argument(
"--baseline-file", type=Path,
help="Baseline ranking configuration JSON file",
)
candidate_rule = indexer_compare.add_mutually_exclusive_group(required=True)
candidate_rule.add_argument(
"--candidate", choices=tuple(MANAGED_RANKING_POLICIES),
help="Registered candidate ranking policy",
)
candidate_rule.add_argument(
"--candidate-file", type=Path,
help="Candidate ranking configuration JSON file (unregistered id)",
)
indexer_compare.add_argument(
"--space-file", type=Path,
help="Optional frozen RankingSpace JSON; candidate weights must lie inside it",
)
indexer_compare.add_argument(
"--context-bytes", type=int,
help="Optional uniform context byte budget override across all cases in both arms",
)
indexer_compare.add_argument(
"--allowed-split", action="append", default=[],
help="Restrict allowed case split names (e.g. development); repeatable",
)
indexer_compare.add_argument(
"--metric", action="append", choices=_INDEXER_METRICS, default=[],
help="Select metrics for descriptive conclusion; repeatable",
)
indexer_compare.add_argument(
"--tolerance", type=float, default=0.0,
help="Finite nonnegative neutral band for descriptive conclusion (default: 0.0)",
)
_read_sources(indexer_compare)
indexer_compare.add_argument(
"--output", type=Path,
help="Write the JSON comparison report to a new file path",
)
show = actions.add_parser("show")
show.add_argument("task", help="Packaged engineering task name")
run = actions.add_parser("run", help="Run the selected task's benchmark.py")
Expand Down
Loading
Loading