Skip to content
Open
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: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ htmlcov/
# Local reference repos
/for_reference_only/
.codex
_audit_ledger.md
_comment_ledger.md
skills/**/build
skills/.curated/
Expand Down
2 changes: 1 addition & 1 deletion docs/RALLY_CLAUDE_CODE_FIRST_CLASS_ADAPTER_SUPPORT.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ What is truly done:
- `--permission-mode dontAsk`
- explicit `--tools`
- explicit `--allowedTools`
- adapter-owned `src/rally/adapters/claude_code/session_store.py`
- per-agent session records via the shared helpers in `src/rally/adapters/base.py`
- the Claude fallback loader now accepts fenced JSON blocks from live Claude
output in both `result.result` and assistant text content

Expand Down
7 changes: 4 additions & 3 deletions docs/RALLY_RUNTIME.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,10 @@ The current checked-in runtime surface is:
- expands optional `runtime.env` values from `flow.yaml`
- applies that flow env to startup host-input checks, setup, and adapter launches
- lets flow env override duplicate shell env while still keeping Rally and adapter keys last
- `src/rally/adapters/codex/session_store.py`
- saves one session id per agent
- writes per-turn `exec.jsonl`, `stderr.log`, and `last_message.json`
- `src/rally/adapters/base.py`
- owns the shared per-agent session store used by both adapters
- `load_adapter_session` / `record_adapter_session` manage one session id per agent
- `prepare_adapter_turn_artifacts` writes per-turn `exec.jsonl`, `stderr.log`, and `last_message.json`
- `src/rally/services/runner.py`
- rebuilds the current flow under the flow lock before loading compiled
agents
Expand Down
52 changes: 28 additions & 24 deletions flows/_stdlib_smoke/prompts/AGENTS.prompt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import rally.base_agent as base
import rally.review_results as review_results
import rally.turn_results as turn_results
import rally.base_agent
import rally.review_results
import rally.turn_results
from rally.review_results import ReviewVerdict
from rally.turn_results import RallyTurnKind


input WorkBrief: "Work Brief"
Expand All @@ -18,7 +20,7 @@ input RoutingFacts: "Routing Facts"


input PreviousPlanAuthorTurn: "Previous Plan Author Turn"
source: base.RallyPreviousTurnOutput
source: rally.base_agent.RallyPreviousTurnOutput
requirement: Advisory
"Use the exact previous PlanAuthor turn JSON when RouteRepair receives a handoff."

Expand All @@ -29,6 +31,7 @@ input RepairPlanReviewFile: "Repair Plan Review File"
shape: MarkdownDocument
requirement: Required
basis_missing: "Basis Missing"
artifact_unnamed: "Artifact Unnamed"
"Use the repair plan file as the review subject for the smoke test."


Expand All @@ -40,7 +43,7 @@ output RepairPlan: "Repair Plan"
"Write the repair plan to `home:artifacts/repair_plan.md`."


output schema PlanAuthorTurnResultSchema[turn_results.BaseRallyTurnResultSchema]: "Plan Author Turn Result Schema"
output schema PlanAuthorTurnResultSchema[rally.turn_results.BaseRallyTurnResultSchema]: "Plan Author Turn Result Schema"
route field next_route: "Next Route"
route_repair: "Send the smoke test to RouteRepair." -> RouteRepair
nullable
Expand All @@ -49,7 +52,7 @@ output schema PlanAuthorTurnResultSchema[turn_results.BaseRallyTurnResultSchema]
inherit {kind, summary, reason, sleep_duration_seconds, agent_issues}


output shape PlanAuthorTurnResultJson[turn_results.BaseRallyTurnResultJson]: "Plan Author Turn Result JSON"
output shape PlanAuthorTurnResultJson[rally.turn_results.BaseRallyTurnResultJson]: "Plan Author Turn Result JSON"
inherit kind
override schema: PlanAuthorTurnResultSchema

Expand All @@ -63,7 +66,7 @@ output shape PlanAuthorTurnResultJson[turn_results.BaseRallyTurnResultJson]: "Pl
"Use `null` for `next_route` when you block or sleep."


output PlanAuthorTurnResult[turn_results.BaseRallyTurnResult]: "Plan Author Turn Result"
output PlanAuthorTurnResult[rally.turn_results.BaseRallyTurnResult]: "Plan Author Turn Result"
inherit target
override shape: PlanAuthorTurnResultJson
inherit requirement
Expand All @@ -78,7 +81,7 @@ output PlanAuthorTurnResult[turn_results.BaseRallyTurnResult]: "Plan Author Turn
"Write one short closeout summary."


output schema RouteRepairTurnResultSchema[turn_results.BaseRallyTurnResultSchema]: "Route Repair Turn Result Schema"
output schema RouteRepairTurnResultSchema[rally.turn_results.BaseRallyTurnResultSchema]: "Route Repair Turn Result Schema"
route field next_route: "Next Route"
closeout: "Send the smoke test to Closeout." -> Closeout
retry: "Send the smoke test back to PlanAuthor." -> PlanAuthor
Expand All @@ -88,7 +91,7 @@ output schema RouteRepairTurnResultSchema[turn_results.BaseRallyTurnResultSchema
inherit {kind, summary, reason, sleep_duration_seconds, agent_issues}


output shape RouteRepairTurnResultJson[turn_results.BaseRallyTurnResultJson]: "Route Repair Turn Result JSON"
output shape RouteRepairTurnResultJson[rally.turn_results.BaseRallyTurnResultJson]: "Route Repair Turn Result JSON"
inherit kind
override schema: RouteRepairTurnResultSchema

Expand All @@ -101,7 +104,7 @@ output shape RouteRepairTurnResultJson[turn_results.BaseRallyTurnResultJson]: "R
"Use null for `next_route` only when you block or sleep."


output RouteRepairTurnResult[turn_results.BaseRallyTurnResult]: "Route Repair Turn Result"
output RouteRepairTurnResult[rally.turn_results.BaseRallyTurnResult]: "Route Repair Turn Result"
inherit target
override shape: RouteRepairTurnResultJson
inherit requirement
Expand All @@ -111,7 +114,7 @@ output RouteRepairTurnResult[turn_results.BaseRallyTurnResult]: "Route Repair Tu
"Use `retry` to send it back for one more pass."


output schema CloseoutTurnResultSchema[turn_results.BaseRallyTurnResultSchema]: "Closeout Turn Result Schema"
output schema CloseoutTurnResultSchema[rally.turn_results.BaseRallyTurnResultSchema]: "Closeout Turn Result Schema"
inherit {kind, summary, reason, sleep_duration_seconds, agent_issues}

field current_artifact: "Current Artifact"
Expand All @@ -129,19 +132,19 @@ output schema CloseoutTurnResultSchema[turn_results.BaseRallyTurnResultSchema]:
current_artifact: "home:artifacts/repair_plan.md"


output shape CloseoutTurnResultJson[turn_results.BaseRallyTurnResultJson]: "Closeout Turn Result JSON"
output shape CloseoutTurnResultJson[rally.turn_results.BaseRallyTurnResultJson]: "Closeout Turn Result JSON"
inherit kind
override schema: CloseoutTurnResultSchema
inherit field_notes


output CloseoutTurnResult[turn_results.BaseRallyTurnResult]: "Closeout Turn Result"
output CloseoutTurnResult[rally.turn_results.BaseRallyTurnResult]: "Closeout Turn Result"
inherit target
override shape: CloseoutTurnResultJson
inherit requirement


output schema SmokeReviewSchema[review_results.BaseRallyReviewSchema]: "Smoke Review Schema"
output schema SmokeReviewSchema[rally.review_results.BaseRallyReviewSchema]: "Smoke Review Schema"
inherit {verdict, reviewed_artifact, analysis_performed, findings_first, current_artifact, next_owner, failure_detail}

override example:
Expand All @@ -156,13 +159,13 @@ output schema SmokeReviewSchema[review_results.BaseRallyReviewSchema]: "Smoke Re

# Keep the JSON shape explicit because the schema override is the main thing a
# reader needs to spot here.
output shape SmokeReviewJson[review_results.BaseRallyReviewJson]: "Smoke Review JSON"
output shape SmokeReviewJson[rally.review_results.BaseRallyReviewJson]: "Smoke Review JSON"
inherit kind
override schema: SmokeReviewSchema
inherit field_notes


output SmokeReviewResponse[review_results.BaseRallyReviewResponse]: "Smoke Review Response"
output SmokeReviewResponse[rally.review_results.BaseRallyReviewResponse]: "Smoke Review Response"
inherit target
override shape: SmokeReviewJson
inherit {requirement, verdict, reviewed_artifact, analysis_performed, findings_first, current_artifact, next_owner, failure_detail, trust_surface, standalone_read}
Expand Down Expand Up @@ -203,6 +206,7 @@ review SmokeReview: "Smoke Review"
block "The repair plan is missing." when RepairPlanReviewFile.basis_missing

contract_checks: "Contract Checks"
reject contract.artifact_named when RepairPlanReviewFile.artifact_unnamed
accept "The smoke review contract passes." when contract.passes

on_accept:
Expand All @@ -212,7 +216,7 @@ review SmokeReview: "Smoke Review"
current artifact RepairPlanReviewFile via SmokeReviewResponse.current_artifact


agent PlanAuthor[base.RallyManagedBaseAgent]:
agent PlanAuthor[rally.base_agent.RallyManagedBaseAgent]:
role: "Write the repair plan and either pass the smoke test forward or finish it."
inherit {rally_contract, read_first, shared_rules}
workflow: "Plan"
Expand All @@ -221,12 +225,12 @@ agent PlanAuthor[base.RallyManagedBaseAgent]:
"Otherwise finish the smoke test here."
# These wrapper refs are safe on one line because each slot only forwards
# one declaration and adds no local prose.
inputs[base.RallyManagedInputs]: "Inputs"
inputs[rally.base_agent.RallyManagedInputs]: "Inputs"
inherit issue_ledger

work_brief: WorkBrief
routing_facts: RoutingFacts
outputs[base.RallyManagedOutputs]: "Outputs"
outputs[rally.base_agent.RallyManagedOutputs]: "Outputs"
inherit issue_note

# Keep `Turn Result` explicit because the wrapper title still helps the
Expand All @@ -240,17 +244,17 @@ agent PlanAuthor[base.RallyManagedBaseAgent]:
route: next_route


agent RouteRepair[base.RallyManagedBaseAgent]:
agent RouteRepair[rally.base_agent.RallyManagedBaseAgent]:
role: "Pick the next smoke-test owner from the emitted route choice."
inherit {rally_contract, read_first, shared_rules}
workflow: "Route Repair"
"Read `Previous Plan Author Turn` first so you know why PlanAuthor sent work here."
"Choose whether the smoke test should close out now or loop back for one more pass."
inputs[base.RallyManagedInputs]: "Inputs"
inputs[rally.base_agent.RallyManagedInputs]: "Inputs"
inherit issue_ledger

previous_plan_author_turn: PreviousPlanAuthorTurn
outputs[base.RallyManagedOutputs]: "Outputs"
outputs[rally.base_agent.RallyManagedOutputs]: "Outputs"
inherit issue_note

turn_result: "Turn Result"
Expand All @@ -260,12 +264,12 @@ agent RouteRepair[base.RallyManagedBaseAgent]:
route: next_route


agent Closeout[base.RallyManagedBaseAgent]:
agent Closeout[rally.base_agent.RallyManagedBaseAgent]:
role: "End the smoke test with a final `done` result."
inherit {rally_contract, read_first, shared_rules}
workflow: "Closeout"
"End the smoke test with one final `done` result."
outputs[base.RallyManagedOutputs]: "Outputs"
outputs[rally.base_agent.RallyManagedOutputs]: "Outputs"
inherit issue_note

turn_result: "Turn Result"
Expand Down
36 changes: 19 additions & 17 deletions flows/poem_loop/prompts/AGENTS.prompt
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import rally.base_agent as base
import rally.turn_results as turn_results
import rally.base_agent
import rally.turn_results
from rally.turn_results import RallyTurnKind
from rally.review_results import ReviewVerdict


inputs PoemLoopInputs[base.RallyManagedInputs]: "Inputs"
inputs PoemLoopInputs[rally.base_agent.RallyManagedInputs]: "Inputs"
inherit issue_ledger

poem_draft_file: PoemDraftFile


input PreviousMuseTurn: "Previous Muse Turn"
source: base.RallyPreviousTurnOutput
source: rally.base_agent.RallyPreviousTurnOutput
requirement: Advisory
"Use the exact previous Muse turn JSON when PoemWriter starts a new draft."


input PreviousPoemReview: "Previous Poem Review"
source: base.RallyPreviousTurnOutput
source: rally.base_agent.RallyPreviousTurnOutput
output: PoemReviewFinalResponse
requirement: Advisory
"Use the exact previous PoemCritic review JSON when Muse is revising after a reject loop."
Expand All @@ -35,7 +37,7 @@ inputs WriterInputs[PoemLoopInputs]: "Writer Inputs"
previous_muse_turn: PreviousMuseTurn


output schema MuseTurnResultSchema[turn_results.BaseRallyTurnResultSchema]: "Muse Turn Result Schema"
output schema MuseTurnResultSchema[rally.turn_results.BaseRallyTurnResultSchema]: "Muse Turn Result Schema"
route field next_route: "Next Route"
poem_writer: "Send the guidance to PoemWriter." -> PoemWriter
nullable
Expand Down Expand Up @@ -68,7 +70,7 @@ output schema MuseTurnResultSchema[turn_results.BaseRallyTurnResultSchema]: "Mus
note: "The clearest thing PoemWriter should fix or sharpen next."


output shape MuseTurnResultJson[turn_results.BaseRallyTurnResultJson]: "Muse Turn Result JSON"
output shape MuseTurnResultJson[rally.turn_results.BaseRallyTurnResultJson]: "Muse Turn Result JSON"
inherit kind
override schema: MuseTurnResultSchema

Expand All @@ -83,7 +85,7 @@ output shape MuseTurnResultJson[turn_results.BaseRallyTurnResultJson]: "Muse Tur
"Set the poem fields when you hand off a new draft direction."


output MuseTurnResult[turn_results.BaseRallyTurnResult]: "Muse Turn Result"
output MuseTurnResult[rally.turn_results.BaseRallyTurnResult]: "Muse Turn Result"
inherit target
override shape: MuseTurnResultJson
inherit requirement
Expand All @@ -104,7 +106,7 @@ output MuseTurnResult[turn_results.BaseRallyTurnResult]: "Muse Turn Result"
"Name the clearest thing PoemWriter should fix or sharpen next."


output schema PoemWriterTurnResultSchema[turn_results.BaseRallyTurnResultSchema]: "Poem Writer Turn Result Schema"
output schema PoemWriterTurnResultSchema[rally.turn_results.BaseRallyTurnResultSchema]: "Poem Writer Turn Result Schema"
route field next_route: "Next Route"
poem_critic: "Send the draft to PoemCritic." -> PoemCritic
nullable
Expand All @@ -119,7 +121,7 @@ output schema PoemWriterTurnResultSchema[turn_results.BaseRallyTurnResultSchema]
note: "Short image, mood, or idea that shaped the draft."


output shape PoemWriterTurnResultJson[turn_results.BaseRallyTurnResultJson]: "Poem Writer Turn Result JSON"
output shape PoemWriterTurnResultJson[rally.turn_results.BaseRallyTurnResultJson]: "Poem Writer Turn Result JSON"
inherit kind
override schema: PoemWriterTurnResultSchema

Expand All @@ -135,7 +137,7 @@ output shape PoemWriterTurnResultJson[turn_results.BaseRallyTurnResultJson]: "Po
"Use `null` for `inspiration` when you block or sleep."


output PoemWriterTurnResult[turn_results.BaseRallyTurnResult]: "Poem Writer Turn Result"
output PoemWriterTurnResult[rally.turn_results.BaseRallyTurnResult]: "Poem Writer Turn Result"
inherit target
override shape: PoemWriterTurnResultJson
inherit requirement
Expand All @@ -148,7 +150,7 @@ output PoemWriterTurnResult[turn_results.BaseRallyTurnResult]: "Poem Writer Turn
"Use `null` when you block or sleep."


abstract agent PoemLoopRole[base.RallyManagedBaseAgent]:
abstract agent PoemLoopRole[rally.base_agent.RallyManagedBaseAgent]:
inherit {rally_contract, read_first, shared_rules}
system_context: PoemLoopSystemContext
ground_truth: IssueLedgerGroundTruth
Expand All @@ -161,12 +163,12 @@ agent Muse[PoemLoopRole]:
your_job: MuseJob
quality_bar: MuseQualityBar
inputs: MuseInputs
outputs[base.RallyManagedOutputs]: "Outputs"
outputs[rally.base_agent.RallyManagedOutputs]: "Outputs"
inherit issue_note

turn_result: "Turn Result"
MuseTurnResult
skills: base.RallyManagedSkills
skills: rally.base_agent.RallyManagedSkills
final_output:
output: MuseTurnResult
route: next_route
Expand All @@ -178,7 +180,7 @@ agent PoemWriter[PoemLoopRole]:
your_job: PoemWriterJob
quality_bar: PoemWriterQualityBar
inputs: WriterInputs
outputs[base.RallyManagedOutputs]: "Outputs"
outputs[rally.base_agent.RallyManagedOutputs]: "Outputs"
# Keep `Turn Result` explicit because the wrapper title still helps the
# emitted readback. The other two wrappers are safe on one line because
# they only forward one declaration and add no local prose.
Expand All @@ -187,7 +189,7 @@ agent PoemWriter[PoemLoopRole]:

turn_result: "Turn Result"
PoemWriterTurnResult
skills: base.RallyManagedSkills
skills: rally.base_agent.RallyManagedSkills
final_output:
output: PoemWriterTurnResult
route: next_route
Expand All @@ -205,7 +207,7 @@ agent PoemCritic[PoemLoopRole]:
outputs: "Outputs"
PoemReviewResponse
PoemReviewFinalResponse
skills: base.RallyManagedSkills
skills: rally.base_agent.RallyManagedSkills
final_output:
output: PoemReviewFinalResponse
review_fields:
Expand Down
3 changes: 3 additions & 0 deletions flows/poem_loop/prompts/shared/inputs.prompt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ input PoemDraftFile: "Poem Draft File"
structure: PoemDraftDocument
requirement: Advisory
basis_missing: "Draft Missing"
brief_mismatch: "Brief Mismatch"
rationale_misfit: "Rationale Misfit"
finish_rough: "Finish Rough"
"Use the current poem draft when this turn needs it."
Loading
Loading