Files
ai-engineering/scripts/native-smoke.sh
T
bquarkz a8a8faf5d8 feat: add agent coordination and automatic work completion
Add portable topics and surveys, decision approval history, execution plans, local Codex and Claude adapters, and general agent routing. Consolidate Plan and EPIC results through deterministic completion receipts, reviewed cancellation scope and recoverable reconciliation.

Track the completed WRK-0001 and WRK-0002 records, protocol documentation, source manifests and delivery evidence.

Validation: 117 tests including Modulith; GraalVM 25 native compilation, standalone smoke and ZIP/TAR verification on macOS ARM64; identical persisted context across JVM and native executions.
2026-11-14 01:12:21 +00:00

453 lines
25 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Run from any directory. The executable argument must be an absolute native path.
aie_binary=${1:?Usage: native-smoke.sh /absolute/path/to/ai-engineering}
aie_fixture=$(mktemp -d "${TMPDIR:-/tmp}/ai-engineering-smoke.XXXXXX")
if [[ "${AIE_KEEP_FIXTURE:-0}" != 1 ]]; then trap 'rm -rf "$aie_fixture"' EXIT; fi
cd "$aie_fixture"
"$aie_binary" --help > help.txt
"$aie_binary" --version > version.txt
grep -q 'ai-engineering 0.1.0' version.txt
if "$aie_binary" --unknown > invalid.txt 2>&1; then
echo 'Invalid arguments unexpectedly succeeded' >&2
exit 1
else
test "$?" -eq 2
fi
aie_without_git() {
PATH="$aie_fixture/no-installed-tools" "$aie_binary" "$@"
}
# A source folder is a complete engineering project, even with no Git installed.
mkdir plain
cd plain
printf 'Existing source\n' > main.txt
aie_without_git init --name 'Simple Project' > init.yaml
aie_without_git work create 'Continue application' --goal 'Preserve local context' > work.yaml
printf '%s' 'No repository is required' > proposal.md
aie_without_git discussion add WRK-0001 --text-file proposal.md > discussion.md
aie_without_git artifact add WRK-0001 --file main.txt --purpose 'Initial source evidence' > artifact.yaml
aie_without_git decision draft WRK-0001 --title 'Pilot the protocol' --evidence ART-0001 > decision.yaml
aie_without_git work update WRK-0001 --goal 'Refined local scope' --constraint 'Keep existing source' \
--acceptance 'Context reloads in another process' --format json > updated-work.json
grep -q 'Refined local scope' updated-work.json
grep -q 'DSC-0001' updated-work.json
grep -q 'DEC-0001' updated-work.json
grep -q 'ART-0001' updated-work.json
cp .ai-engineering/works/WRK-0001-continue-application/work.md before-noop.md
aie_without_git work update WRK-0001 --goal 'Refined local scope' > repeated-update.yaml
cmp before-noop.md .ai-engineering/works/WRK-0001-continue-application/work.md
# Exercise compatibility/migration using an exact legacy representation of this entry.
aie_discussion=.ai-engineering/works/WRK-0001-continue-application/discussions/DSC-0001.md
grep -q 'documentVersion: 2' "$aie_discussion"
awk '
/^---$/ { delimiters++; if (delimiters == 2) { print "text: \"No repository is required\""; print "---"; exit } }
/documentVersion:/ { next }
{ print }
' "$aie_discussion" > legacy.md
cp legacy.md "$aie_discussion"
aie_without_git work context WRK-0001 --format json > before.json
aie_without_git discussion migrate WRK-0001 --format json > migration.json
grep -q '"converted" : 1' migration.json
grep -q 'documentVersion: 2' "$aie_discussion"
aie_without_git discussion migrate WRK-0001 --format json > repeated-migration.json
grep -q '"converted" : 0' repeated-migration.json
mkdir src
cd src
aie_without_git work context WRK-0001 --format json > ../after.json
cd ..
cmp before.json after.json
aie_without_git project validate --format json > validation.json
grep -q '"valid" : true' validation.json
test ! -e .git
cd "$aie_fixture"
# A single Git repository can contain both the source and protocol workspace.
git init -q single
cd single
"$aie_binary" init --name 'Single Repository' > init.yaml
"$aie_binary" repo add app --path . > repo.yaml
"$aie_binary" work create 'Inspect application' --repo app > work.yaml
"$aie_binary" work context WRK-0001 --format json > before.json
mkdir src
cd src
"$aie_binary" work context WRK-0001 --format json > ../after.json
cd ..
cmp before.json after.json
grep -q '"repositoryId" : "app"' after.json
"$aie_binary" project validate --format json > validation.json
grep -q '"valid" : true' validation.json
cd "$aie_fixture"
echo 'Native simple-project continuity smoke passed (without Git and with one root repository).'
# Work numbers are hexadecimal; child counters still use decimal.
mkdir hexadecimal
cd hexadecimal
aie_without_git init --name 'Hexadecimal Works' > init.yaml
for aie_number in {1..16}; do
aie_without_git work create "Work $aie_number" > "work-$aie_number.yaml"
done
grep -q 'id: "WRK-0009"' work-9.yaml
grep -q 'id: "WRK-000A"' work-10.yaml
grep -q 'id: "WRK-000F"' work-15.yaml
grep -q 'id: "WRK-0010"' work-16.yaml
grep -q 'lastWork: "0010"' .ai-engineering/works/.sequence.yaml
aie_without_git discussion add WRK-000A --text 'Continue a hexadecimal Work' > discussion.md
aie_without_git decision draft WRK-000A --title 'Hex Work draft' > decision.yaml
aie_without_git work update WRK-000A --goal 'Hexadecimal continuity' > updated-work.yaml
aie_without_git work context WRK-000A --format json > before.json
mkdir src
cd src
aie_without_git work context WRK-000A --format json > ../after.json
cd ..
cmp before.json after.json
aie_without_git project validate --format json > validation.json
grep -q '"valid" : true' validation.json
cd "$aie_fixture"
# Reserve all old decimal spellings, including removed Works, when upgrading counters.
mkdir legacy-counter
cd legacy-counter
aie_without_git init --name 'Legacy reservations' > init.yaml
printf 'schemaVersion: 1\nlastWork: 16\n' > .ai-engineering/works/.sequence.yaml
aie_without_git work create 'After legacy reservation' > work.yaml
grep -q 'id: "WRK-0017"' work.yaml
grep -q 'schemaVersion: 2' .ai-engineering/works/.sequence.yaml
aie_without_git project validate --format json > validation.json
grep -q '"valid" : true' validation.json
cd "$aie_fixture"
echo 'Native hexadecimal Work identifiers and legacy reservations smoke passed.'
# Exercise the refinement contract with two fixture adapters and fresh processes.
mkdir refinement
cd refinement
aie_without_git init --name 'Refinement fixture' --general-adapter fixture-general \
--archive-policy reversible > init.yaml
aie_without_git work create 'Compare ideas' > work.yaml
printf 'Rendering: measure layers\nInput: compare controls\n' > ideas.md
aie_without_git agent run WRK-0001 --task-file ideas.md --request-id ideas --requester fixture-human > refinement.md
aie_without_git topic list WRK-0001 --format json > topics.json
grep -q TOP-0002 topics.json
aie_without_git next-actions WRK-0001 --format json > actions.json
grep -q SVY-0001 actions.json
printf '2\n' > answers.txt
aie_without_git survey ask WRK-0001 SVY-0001 --input-file answers.txt --author fixture-human > guided.txt
grep -q 'All pending questions answered' guided.txt
aie_without_git survey answer WRK-0001 SVY-0001 QST-0001 \
--text 'Compare both approaches instead' --author fixture-human > revised-answer.yaml
aie_without_git survey history WRK-0001 SVY-0001 --format json > survey-history.json
grep -q ANS-0001 survey-history.json
grep -q ANS-0002 survey-history.json
printf 'Explicitly synthetic observation, not a game measurement\n' > fixture.txt
aie_without_git artifact add WRK-0001 --file fixture.txt --purpose 'Synthetic contract evidence' > artifact.yaml
aie_without_git agent configure --activity analyze --adapter fixture-reviewer > agents.yaml
aie_without_git agent run WRK-0001 --task 'analyze: compare persisted proposals' \
--request-id analysis --requester fixture-agent > analysis.md
grep -q fixture-reviewer analysis.md
grep -q 'approvalStatus: "DRAFT"' .ai-engineering/works/WRK-0001-compare-ideas/decisions/DEC-0001.md
cp .ai-engineering/works/WRK-0001-compare-ideas/work.md before-replay.md
aie_without_git agent run WRK-0001 --task 'analyze: compare persisted proposals' \
--request-id analysis --requester fixture-agent > replay.md
cmp analysis.md replay.md
cmp before-replay.md .ai-engineering/works/WRK-0001-compare-ideas/work.md
aie_without_git discussion restore WRK-0001 DSC-0002 --reason 'Reconsider fixture proposal' --by fixture-agent > restored.md
aie_without_git agent run WRK-0001 --task 'summarize persisted results' --request-id summary > summary.md
aie_without_git agent history WRK-0001 --format json > runs-before.json
grep -q '"stale" : false' runs-before.json
aie_without_git discussion add WRK-0001 --text 'New observation after summary' --author fixture-human > observation.md
aie_without_git agent history WRK-0001 --format json > runs-after.json
if grep -q '"stale" : false' runs-after.json; then echo 'Summary incorrectly remained fresh' >&2; exit 1; fi
aie_without_git work context WRK-0001 --format json > before.json
aie_without_git work context WRK-0001 --format markdown > before.md
mkdir -p src/nested
cd src/nested
aie_without_git work context WRK-0001 --format json > ../../after.json
aie_without_git work context WRK-0001 --format markdown > ../../after.md
cd ../..
cmp before.json after.json
cmp before.md after.md
for aie_expected in TOP-0002 SVY-0001 ANS-0001 ANS-0002 DSP-0001 DSP-0002 RUN-0003 fixture-general fixture-reviewer; do
grep -q "$aie_expected" after.json
done
aie_without_git project validate --format json > validation.json
grep -q '"valid" : true' validation.json
test ! -e .git
cd "$aie_fixture"
echo 'Native refinement smoke passed (topics, surveys, revised answers, two fixtures, dispositions, draft DEC, idempotency and staleness).'
# Deterministic CLI protocol fixtures: exercise the native process runner without a JVM/model.
mkdir -p providers local-cli
cat > providers/codex <<'AIE_PROVIDER'
#!/bin/sh
provider=${0##*/}
schema=
reply=
while [ "$#" -gt 0 ]; do
case "$1" in
--version)
case "$provider" in codex) printf 'codex-cli 0.169.0\n';; *) printf '2.1.311 (Claude Code)\n';; esac
exit 0;;
--help) printf '%s\n' '--output-schema --output-last-message --ignore-user-config --ephemeral --sandbox --json-schema --tools --restricted --safe-mode --permission-prompts --no-session-persistence'; exit 0;;
--output-schema) shift; schema=$1;;
--output-last-message) shift; reply=$1;;
--json-schema) shift; schema=$1;;
esac
shift
done
while IFS= read -r line; do :; done
classification=0
case "$provider" in
codex) while IFS= read -r line; do case "$line" in *'"activity"'*) classification=1;; esac; done < "$schema";;
*) case "$schema" in *'"activity"'*) classification=1;; esac;;
esac
if [ "$classification" = 1 ]; then
wire='{"schemaVersion":1,"activity":"summarize"}'
else
wire='{"schemaVersion":1,"summary":"Native subprocess fixture summary; source DSC-0001","topics":[],"surveys":[],"entries":[],"dispositions":[],"decision":null}'
fi
case "$provider" in
codex) printf '%s\n' "$wire" > "$reply"; printf '{"type":"turn.completed"}\n';;
*) printf '{"subtype":"success","is_error":false,"structured_output":%s}\n' "$wire";;
esac
AIE_PROVIDER
cp providers/codex providers/claude
chmod +x providers/codex providers/claude
export AIE_CODEX_EXECUTABLE="$aie_fixture/providers/codex"
export AIE_CLAUDE_EXECUTABLE="$aie_fixture/providers/claude"
cd local-cli
printf '1\ngeneral\ndefault\n5\n1\n3\nreviewer\ndefault\n5\n1\n' > setup.txt
aie_without_git init . --name 'Native CLI fixture' --interactive --input-file setup.txt > setup.yaml
aie_without_git agent doctor --format json > doctor.json
grep -q '"compatible" : true' doctor.json
aie_without_git work create 'Provider protocol' > work.yaml
aie_without_git discussion add WRK-0001 --text 'Synthetic source for provider protocol tests' > source.md
aie_without_git agent run WRK-0001 --task 'Summarize the synthetic note' --request-id classified --format json > codex.json
grep -q '"classification" : {' codex.json
aie_without_git agent run WRK-0001 --activity analyze --task 'Continue from persisted context' --request-id reviewed --format json > claude.json
grep -q '"transport" : "claude-cli"' claude.json
grep -q '"fixture" : false' claude.json
cp .ai-engineering/works/WRK-0001-provider-protocol/work.md before-replay.md
aie_without_git agent run WRK-0001 --activity analyze --task 'Continue from persisted context' --request-id reviewed > replay.md
cmp before-replay.md .ai-engineering/works/WRK-0001-provider-protocol/work.md
aie_without_git work context WRK-0001 --format json > before.json
mkdir -p src/nested
cd src/nested
aie_without_git work context WRK-0001 --format json > ../../after.json
cd ../..
cmp before.json after.json
aie_without_git project validate --format json > validation.json
grep -q '"valid" : true' validation.json
cd "$aie_fixture"
unset AIE_CODEX_EXECUTABLE AIE_CLAUDE_EXECUTABLE
echo 'Native local-CLI transport smoke passed (controlled subprocess fixtures, guided setup, routing, provenance, replay and reload without JVM/models).'
# EPIC state control is entirely deterministic and does not need configured agents.
mkdir epic-coordination
cd epic-coordination
aie_without_git init --name 'EPIC coordination fixture' > init.yaml
for aie_title in Parent Required Cancelled Optional; do
aie_without_git work create "$aie_title" --acceptance 'Reviewed fixture result' > "$aie_title.yaml"
done
aie_without_git epic configure WRK-0001 --mode results --by fixture-agent --reason 'Coordinate slices' > epic.md
for aie_child in WRK-0002 WRK-0003 WRK-0004; do
aie_without_git epic link WRK-0001 "$aie_child" --by fixture-agent --reason 'Decomposition' > link.md
done
aie_without_git epic importance WRK-0001 WRK-0004 --optional --by fixture-owner --reason 'Follow-up only' > optional.md
aie_without_git epic authorize WRK-0001 --by fixture-owner --reason 'Explicit aggregate delegation' --human-approved > authorized.yaml
printf 'Synthetic delivery evidence, not real product validation\n' > evidence.txt
aie_without_git artifact add WRK-0002 --file evidence.txt --purpose 'Synthetic delivery' > artifact.yaml
aie_without_git work complete WRK-0002 --by fixture-owner --summary 'Reviewed fixture' --human-approved \
--criterion 1=ART-0001 --no-integration-needed 'Disposable fixture' --requester fixture-agent --request-id child-delivery --format json > first-result.json
grep -q WRK-0003 first-result.json
aie_without_git work status WRK-0003 CANCELLED --by fixture-owner --reason 'Requires scope review' > cancelled.yaml
if aie_without_git epic check WRK-0001 --format json > pending.json; then
echo 'An important cancelled child unexpectedly satisfied the EPIC' >&2; exit 1
else
test "$?" -eq 4
fi
grep -q CANCELLED pending.json
aie_without_git epic importance WRK-0001 WRK-0003 --optional --by fixture-owner --reason 'Explicitly reviewed exclusion' > reviewed-scope.md
aie_without_git epic authorize WRK-0001 --by fixture-owner --reason 'Reduced aggregate scope approved' --human-approved > second-authority.yaml
aie_without_git work context WRK-0001 --format json > before.json
aie_without_git work context WRK-0001 --format markdown > before.md
grep -q SYSTEM_EPIC before.json
grep -q '"humanApproved" : false' before.json
aie_without_git work show WRK-0004 --format json > optional.json
grep -q '"status" : "OPEN"' optional.json
mkdir -p src/nested
cd src/nested
aie_without_git work context WRK-0001 --format json > ../../after.json
aie_without_git work context WRK-0001 --format markdown > ../../after.md
cd ../..
cmp before.json after.json
cmp before.md after.md
aie_without_git work archive WRK-0001 --by fixture-owner --reason 'Retain receipt' > archived.yaml
aie_without_git work reopen WRK-0002 --by fixture-owner --reason 'New observation' > reopened.yaml
aie_without_git work show WRK-0001 --format json > parent-reopened.json
grep -q '"status" : "ACTIVE"' parent-reopened.json
grep -q '"archived" : false' parent-reopened.json
aie_without_git work complete WRK-0002 --by fixture-owner --summary 'Reviewed new fixture' --human-approved \
--criterion 1=ART-0001 --no-integration-needed 'Disposable fixture' > new-completion.yaml
cp .ai-engineering/works/WRK-0001-parent/work.md completed-before-reconcile.md
aie_without_git epic reconcile WRK-0001 --requester another-agent --request-id replay > reconciled.yaml
cmp completed-before-reconcile.md .ai-engineering/works/WRK-0001-parent/work.md
aie_without_git epic history WRK-0001 --format json > policy-history.json
grep -q 'Explicitly reviewed exclusion' policy-history.json
aie_without_git work reopen WRK-0001 --by fixture-owner --reason 'Explicitly begin replanning' > manual-reopen.yaml
aie_without_git epic reconcile WRK-0001 > held-open.yaml
aie_without_git work show WRK-0001 --format json > replanning.json
grep -q '"status" : "ACTIVE"' replanning.json
aie_without_git work create 'Decomposition' --acceptance 'Recorded decomposition' > decomposition.yaml
aie_without_git work create 'Future execution' --acceptance 'Future child result' > future.yaml
aie_without_git epic configure WRK-0005 --mode decomposition --by fixture-agent --reason 'Deliver only decomposition' > decomposition-policy.md
aie_without_git epic link WRK-0005 WRK-0006 --by fixture-agent --reason 'Future scope' > future-link.md
aie_without_git artifact add WRK-0005 --file evidence.txt --purpose 'Synthetic decomposition evidence' > decomposition-evidence.yaml
aie_without_git work complete WRK-0005 --by fixture-owner --summary 'Decomposition reviewed' --human-approved \
--criterion 1=ART-0001 --no-integration-needed 'Disposable fixture' > decomposition-complete.yaml
aie_without_git project validate --format json > validation.json
grep -q '"valid" : true' validation.json
test ! -e .git
cd "$aie_fixture"
echo 'Native EPIC smoke passed (delegation, important/cancelled/optional children, system receipts, reopen, replay, decomposition and nested context).'
# Git initialization is fixture setup, never an implicit CLI operation.
git init -q runtime
git init -q studio
for aie_repo in runtime studio; do
git -C "$aie_repo" -c user.name=Fixture -c user.email=fixture@example.invalid \
commit -q --allow-empty -m fixture
done
"$aie_binary" init --name 'Continuity Experiment' > init.yaml
"$aie_binary" repo add runtime --path runtime --language rust > runtime.yaml
"$aie_binary" repo add studio --path studio --language java > studio.yaml
"$aie_binary" work create 'Improve scene editor' --repo runtime --repo studio \
--goal 'Continue across agents' --constraint 'No server' \
--acceptance 'Fresh process reconstructs state' > work.yaml
"$aie_binary" discussion add WRK-0001 --kind QUESTION --author agent-a \
--text 'Evaluate Canvas rendering?' > discussion.yaml
printf 'Observed fixture result: 60 fps\n' > result.txt
"$aie_binary" artifact add WRK-0001 --file result.txt --purpose 'Rendering evidence' > artifact.yaml
"$aie_binary" decision draft WRK-0001 --title 'Evaluate layered Canvas' \
--evidence ART-0001 > decision.yaml
"$aie_binary" work context WRK-0001 --format json > before.json
mkdir -p studio/src/editor
cd studio/src/editor
"$aie_binary" work context WRK-0001 --format json > "$aie_fixture/after.json"
cd "$aie_fixture"
cmp before.json after.json
for aie_expected in runtime studio agent-a DRAFT sha256 'Continue across agents'; do
grep -q "$aie_expected" after.json
done
"$aie_binary" work context WRK-0001 --format markdown > context.md
"$aie_binary" project validate --format json > validation.json
grep -q '"valid" : true' validation.json
test ! -e .git
echo 'Native multi-repository continuity smoke passed.'
# Complete the same multi-repository Work; each command is a fresh native process.
test -f .ai-engineering/README.md
test -f .ai-engineering/protocol.json
grep -q '.ai-engineering/README.md' AGENTS.md
"$aie_binary" guide --format json > guide.json
grep -q 'capabilities' guide.json
cp AGENTS.md agents-before.md
"$aie_binary" onboard > onboarding.yaml
cmp agents-before.md AGENTS.md
"$aie_binary" next-actions WRK-0001 --format json > actions.json
grep -q 'RESPOND' actions.json
"$aie_binary" discussion add WRK-0001 --kind CONCLUSION --responds-to DSC-0001 \
--text 'The disposable fixture supports the chosen approach.' > conclusion.md
"$aie_binary" decision update WRK-0001 DEC-0001 --context 'Continuity fixture' \
--approach 'Persist a bounded result' --rationale 'Demonstrate fresh-process continuity' \
--by agent-a --reason 'Refine the proposal' > updated-decision.yaml
"$aie_binary" decision accept WRK-0001 DEC-0001 --by fixture-owner --reason 'Reviewed fixture' \
--human-approved > accepted.yaml
"$aie_binary" plan create WRK-0001 --title 'Validate continuity' --decision DEC-0001 > plan.yaml
"$aie_binary" plan step add WRK-0001 PLN-0001 --title 'Check persisted result' > step.yaml
"$aie_binary" plan step status WRK-0001 PLN-0001 TSK-0001 COMPLETED --by agent-b \
--reason 'Result payload checked in the fixture' --evidence ART-0001 > step-result.yaml
"$aie_binary" plan status WRK-0001 PLN-0001 COMPLETED --by agent-b --reason 'Step result recorded' > finished-plan.yaml
"$aie_binary" work check WRK-0001 > readiness.yaml
"$aie_binary" work reconcile WRK-0001 --requester agent-b --request-id portable-completion > completion.yaml
grep -q 'COMPLETED' completion.yaml
grep -q 'SYSTEM_PLANS' step-result.yaml
"$aie_binary" work archive WRK-0001 --by fixture-owner --reason 'Retain fixture evidence' > archive.yaml
"$aie_binary" status --format json > status.json
grep -q '"works" : \[ \]' status.json
"$aie_binary" status --all --format json > all-status.json
grep -q 'WRK-0001' all-status.json
"$aie_binary" work context WRK-0001 --format json > closed-before.json
cd studio/src/editor
"$aie_binary" work context WRK-0001 --format json > "$aie_fixture/closed-after.json"
cd "$aie_fixture"
cmp closed-before.json closed-after.json
for aie_expected in ACCEPTED PLN-0001 TSK-0001 scopeHash fixture-owner protocolGuide; do
grep -q "$aie_expected" closed-after.json
done
"$aie_binary" decision history WRK-0001 DEC-0001 --format json > decision-history.json
grep -q 'DRAFT' decision-history.json
grep -q 'ACCEPTED' decision-history.json
"$aie_binary" plan history WRK-0001 PLN-0001 --format json > plan-history.json
grep -q 'All required steps completed' plan-history.json
"$aie_binary" work reopen WRK-0001 --by fixture-owner --reason 'Continue with new observations' > reopened.yaml
"$aie_binary" discussion add WRK-0001 --text 'A different agent can continue here.' --author agent-c > continuation.md
"$aie_binary" decision revise WRK-0001 DEC-0001 --by agent-c --reason 'New observations justify reconsideration' > revised.yaml
"$aie_binary" decision update WRK-0001 DEC-0002 --approach 'A revised bounded experiment' \
--by agent-c --reason 'Refined alternative' > refined.yaml
"$aie_binary" decision accept WRK-0001 DEC-0002 --by fixture-owner --reason 'Reviewed revised scope' \
--human-approved > replacement.yaml
"$aie_binary" decision list WRK-0001 --format json > decisions.json
grep -q 'SUPERSEDED' decisions.json
"$aie_binary" plan status WRK-0001 PLN-0001 ACTIVE --by agent-c --reason 'Reconsider the earlier plan' > reconsidered.yaml
"$aie_binary" plan update WRK-0001 PLN-0001 --decision DEC-0002 --by agent-c --reason 'Align to the revised decision' > replanned.yaml
"$aie_binary" plan step status WRK-0001 PLN-0001 TSK-0001 OPEN --by agent-c --reason 'Collect new evidence' > resumed-step.yaml
"$aie_binary" work context WRK-0001 --format json > resumed.json
grep -q 'SYSTEM_PLANS' resumed.json
grep -q 'A different agent can continue here.' resumed.json
"$aie_binary" project validate --format json > validation.json
grep -q '"valid" : true' validation.json
echo 'Native operational-cycle smoke passed (discovery, approval, plan, evidence, completion, archive and reopening).'
# Automatic consolidation across independent native processes without Git/JVM/models.
mkdir "$aie_fixture/plan-consolidation"
cd "$aie_fixture/plan-consolidation"
aie_without_git init --name 'Plan consolidation' > init.yaml
aie_without_git work create 'Delivery' > work.yaml
printf 'Synthetic executed result\n' > result.txt
aie_without_git artifact add WRK-0001 --file result.txt --purpose 'Fixture execution' > evidence.yaml
aie_without_git next-actions WRK-0001 --format json > empty-actions.json
grep -q CREATE_PLAN empty-actions.json
aie_without_git plan create WRK-0001 --title 'First' > plan1.yaml
aie_without_git plan create WRK-0001 --title 'Second' > plan2.yaml
aie_without_git plan step add WRK-0001 PLN-0001 --title 'First result' > step1.yaml
aie_without_git plan step add WRK-0001 PLN-0002 --title 'Second result' > step2.yaml
aie_without_git plan step add WRK-0001 PLN-0002 --title 'Withdrawn scope' > cancelled-step.yaml
aie_without_git plan step status WRK-0001 PLN-0001 TSK-0001 COMPLETED --by fixture \
--reason 'Fixture result checked' --evidence ART-0001 --format json > first-result.json
grep -q 'PLN-0002' first-result.json
aie_without_git plan step status WRK-0001 PLN-0002 TSK-0002 CANCELLED --by fixture --reason 'Deferred' > cancelled.yaml
aie_without_git plan step status WRK-0001 PLN-0002 TSK-0001 COMPLETED --by fixture \
--reason 'Fixture result checked' --evidence ART-0001 > second-result.yaml
aie_without_git work show WRK-0001 --format json > pending.json
grep -q '"status" : "OPEN"' pending.json
aie_without_git plan exclude WRK-0001 PLN-0002 --step TSK-0002 --by fixture-human \
--reason 'Explicit scope reduction' --format json > reviewed.json
grep -q SYSTEM_PLANS reviewed.json
aie_without_git work check WRK-0001 > ready.yaml
cp .ai-engineering/works/WRK-0001-delivery/work.md delivered-before.md
aie_without_git work reconcile WRK-0001 --requester fresh-agent --request-id retry --format json > replay.json
cmp delivered-before.md .ai-engineering/works/WRK-0001-delivery/work.md
aie_without_git work context WRK-0001 --format json > before.json
mkdir nested
cd nested
aie_without_git work context WRK-0001 --format json > ../after.json
cd ..
cmp before.json after.json
aie_without_git project validate --format json > validation.json
grep -q '"valid" : true' validation.json
echo 'Native Plan consolidation smoke passed (multiple Plans, reviewed cancellation, system completion and fresh-process replay; no model/JVM).'
if [[ "${AIE_KEEP_FIXTURE:-0}" == 1 ]]; then echo "Fixture retained: $aie_fixture"; fi