Asupersync Mega Skill
Asupersync is a spec-first runtime for structured concurrency, cancel-correct
effects, obligations, deterministic testing, and capability security—not a
Tokio wrapper. Verify against live evidence.
For release, live-support, or open-boundary questions, start with the
current-status card in
SOURCE-MAP.md.
Otherwise load the single task lane below first. Live source, tags, registry
state, and terminal proof receipts outrank examples or stale tracker labels.
Table of Contents
Bootstrap
Use #[asupersync::main] when the application does not need to own the runtime:
#[asupersync::main]
async fn main() {
println!("hello from asupersync");
}
Use RuntimeBuilder when it does. Runtime-spawned tasks receive a runtime-owned
Cx; pass &Cx into application code. Use production request-context APIs,
explicit spawn admission, and checked joins rather than test constructors or
implicit authority. For handle-only request contexts and caller-owned blocking
pools, read RUNTIME-CONTROLS; attaching a pool
does not install a scheduler or a worker-local lane.
Choose One Lane
Load one primary reference first. Follow its links only when the task reaches
that boundary; do not preload whole clusters.
| Task |
Read first |
| Native greenfield service |
NATIVE-GREENFIELD |
| Brownfield Tokio migration |
BROWNFIELD-MIGRATION |
| Exact Tokio compatibility or quarantine boundary |
COMPAT-BOUNDARY |
| Cx-aware high-level web handler patterns |
GREENFIELD-PATTERNS |
| Runtime, cancellation, shutdown, or local tasks |
RUNTIME-CONTROLS |
| Channels, locks, or combinators |
PRIMITIVES-AND-ORCHESTRATION-CHOOSER |
| Observability, diagnostics, metrics, or OTLP |
OBSERVABILITY-FORENSICS |
| HTTP, gRPC, or high-level web routing |
WEB-GRPC-HTTP |
| Database, messaging, filesystem, process, or signal work |
DB-MESSAGING-FS-PROCESS |
| Protocol or low-level networking work |
NETWORKING-PROTOCOL-STACK |
| Lab replay, DPOR, or escaped concurrency defect |
TESTING-FORENSICS |
| Supervision or OTP-style components |
SUPERVISION-OTP |
| Browser or Wasm integration |
BROWSER-WASM |
| Distributed execution or rigor |
DISTRIBUTED-AND-RIGOR |
| RaptorQ or ATP security, transfer, or benchmark evidence |
RAPTORQ-DISTRIBUTED |
| Work inside Asupersync, release it, or assess API compatibility |
REPO-CONTRIBUTOR-GUIDE |
| Diagnose an error or uncertain support claim |
TROUBLESHOOTING |
Use browser/Wasm, QUIC/H3, messaging, distributed, or RaptorQ lanes only when
requirements call for them.
Non-Negotiables
- Do not treat Asupersync as an executor swap.
- Put
&Cx first in async APIs you control.
- Use
Scope and child regions for owned work. Avoid detached background tasks.
- Use
Cx::spawn / Cx::spawn_in for ordinary region-owned task creation.
Scope::spawn_registered is a lower-level boot/test path for callers already
holding &mut RuntimeState.
- Add
cx.checkpoint() in loops, retry bodies, long handlers, and shutdown-sensitive code.
- Prefer cancel-aware primitives and two-phase effects.
- State the layered v0.4.4-v0.4.9 cancellation contract precisely: ordinary
Cx::spawn*
preserves a typed result returned after cancellation acknowledgement (a
concurrent abort no longer erases it), but pre-first-poll cancellation and
cancellation-blind late values keep v0.4.3 task-level cancellation, and
JoinSet, cancellation-dominant combinators, blocking wrappers, and
low-level state tasks retain their separately tested policies. Neither
"abort always wins" nor "the value always survives" is correct. Explicit
cancellation wakes timer-parked native tasks; Sleep retires its registration
and completes with () while timeout/deadline combinators retain outcome
classification. Native worker tests, not Lab-only models, prove this boundary.
Cx::spawn_local requires a worker-local lane owned by the same runtime. A
current-thread runtime installs that lane on the caller during block_on,
so its root Cx accepts !Send local tasks. A context from another runtime
or a harness without a local lane still returns LocalSchedulerUnavailable
(ASUP-E004). For other runtime flavors, enter an owner worker with
runtime.block_on(runtime.handle().spawn(async { ... })) and obtain
Cx::current() there. Cancellation evidence must prove the local task
reached the parked state before aborting it.
- Use deterministic tests as part of normal development, not as optional polish.
- Treat
Cx::for_testing() and Cx::for_request() as test/internal harness
paths, not production architecture.
- Keep Tokio and Tokio-only crates behind explicit adapter modules if you must keep them at all.
asupersync-tokio-compat adapts selected traits and context; it does not install a Tokio runtime
or prove Handle::current()-dependent frameworks.
Require downstream compile and runtime evidence for every bridge.
Migration Workflow
- Inventory direct and transitive Tokio-ecosystem dependencies.
- Classify each as native replacement, explicit compat holdout, or deliberate
workaround.
- Use the repository's migration readiness planner when available; do not
confuse a
cargo tree grep with a plan.
- Replace bootstrap, thread
&Cx through owned APIs, then replace detached
spawning with region-owned work.
- Migrate time, sync, I/O, channel, web, database, and protocol slices one at
a time.
- Add deterministic and native cancellation tests during the migration.
- Compile actual external-consumer feature profiles;
cfg(test) access and
repo-internal tests are not downstream API evidence.
- Remove each compat boundary when its last justified dependency is gone.
The planner's summary.final_verdict, proof_pack.proof_commands,
semantic_map.recommendations, and operator_report.phase_plan are inputs to
the decision. scripts/audit-target.sh is only bounded inventory; its optional
Cargo graph probe is explicit and can touch Cargo state.
From the repository root, use scripts/migration_readiness_planner.py:
python3 scripts/migration_readiness_planner.py --dry-run --scenario tokio-http-service
python3 scripts/migration_readiness_planner.py --project-root /path/to/rust/project --output-root target/migration-readiness
python3 scripts/migration_readiness_planner.py --execute --output-root target/migration-planner-fixtures
--execute runs the planner's fixture scenarios; it does not execute the
generated proof commands or establish downstream runtime correctness.
For more-than-parity design:
LEVERAGE-PLAYBOOK,
BUDGET-OUTCOME-CAPABILITIES,
SUPERVISION-OTP, and
ADVANCED-FEATURES.
Other routers: adoption,
anti-patterns,
compat bridge,
replacement matrix,
performance,
browser frameworks, and
mathematics.
Secondary deep dives, only when a primary card routes there (except the two
direct routes named above):
greenfield patterns,
Tokio mappings,
compat limits,
scheduler internals,
channel/sync internals,
lock ordering,
support classes,
Lab/DPOR, and
error taxonomy.
Proof and Repository Rules
- Run the host formatter, compiler, linter, and tests; verify cancellation,
shutdown, and resource release, not compilation alone.
- For an escaped concurrency defect, reproduce the same public API sequence on
the native runtime, prove the formerly failing parked/owned state, assert the
exact nested result and cleanup, and retain old-red/new-green evidence. A
Lab-only or compile-only test is not a substitute.
- RCH pre-admission refusal, exit 103, worker assignment, a job id, a PID, or
local fallback means zero admissible executed tests. Green proof requires
terminal output naming the target and nonzero pass counts from the required
environment.
- Do not key source or evidence authority to
/dp, /data/projects, or an RCH
checkout prefix. Identify the repository by content and declared root.
- Never invoke a waker, user callback, observer, or extension hook while a
runtime-state lock is held. Treat unresolved tracker rows as unshipped
boundaries, not capability claims; refresh them from the status card and live
tracker before reporting current state.
- Exact
ForcedSchedule files are bounded Lab replay evidence, not production
scheduler control, authenticity proof, or automatic minimization.
- Support classes come from live implementation and proof: default production,
optional production, experimental/guarded, compat-only, test/fuzz-only, or
planned. Do not promote a class from prose alone.
Inside Asupersync, follow live AGENTS.md and TESTING_FOR_AGENTS.md; work on
main, do not delete files without permission, and preserve the v0.4.3 public
API and documented behavior throughout 0.4.x. Classify proof through
artifacts/proof_lane_manifest_v1.json and
artifacts/proof_status_snapshot_v1.json: manifest = command/claim/envelope;
snapshot = freshness/blockers; only a terminal receipt proves execution.
Preserve build id, target/artifact roots, and dirty-tree state. Use Beads and
CASS for rationale, corroborated by tagged source and focused evidence.
ATP performance claims require live ledger/matrix artifacts, tuned rsync,
release atp, symmetric crypto, caps, and SHA/tamper checks. A cell proves only
its scope; compilation or sha_ok is not a benchmark win.
Skill Validation
After editing this package run:
./scripts/validate.sh
ASUPERSYNC_SOURCE_ROOT=/path/to/asupersync ./scripts/validate.sh
The second form also validates referenced repository paths and release-sensitive
source anchors. It does not compile Asupersync or replace RCH proof.
If the sw skill is installed elsewhere, set ASUPERSYNC_SKILL_VALIDATOR to
its sw/scripts/validate-skill.py path for either command.
1---2name: asupersync-mega-skill3description: Build, migrate, debug, and maintain Asupersync. Use when working with Tokio migration, Cx/Scope/cancellation, local tasks, Lab replay, browser/Wasm, protocols, databases, OTLP, or repository proof.4---56# Asupersync Mega Skill78Asupersync is a spec-first runtime for structured concurrency, cancel-correct9effects, obligations, deterministic testing, and capability security—not a10Tokio wrapper. Verify against live evidence.1112For release, live-support, or open-boundary questions, start with the13current-status card in14[SOURCE-MAP.md](references/SOURCE-MAP.md#release-and-live-head-status).15Otherwise load the single task lane below first. Live source, tags, registry16state, and terminal proof receipts outrank examples or stale tracker labels.1718## Table of Contents1920- [Bootstrap](#bootstrap)21- [Choose One Lane](#choose-one-lane)22- [Non-Negotiables](#non-negotiables)23- [Migration Workflow](#migration-workflow)24- [Proof and Repository Rules](#proof-and-repository-rules)25- [Skill Validation](#skill-validation)2627## Bootstrap2829Use `#[asupersync::main]` when the application does not need to own the runtime:3031```rust32#[asupersync::main]33async fn main() {34 println!("hello from asupersync");35}36```3738Use `RuntimeBuilder` when it does. Runtime-spawned tasks receive a runtime-owned39`Cx`; pass `&Cx` into application code. Use production request-context APIs,40explicit spawn admission, and checked joins rather than test constructors or41implicit authority. For handle-only request contexts and caller-owned blocking42pools, read [RUNTIME-CONTROLS](references/RUNTIME-CONTROLS.md); attaching a pool43does not install a scheduler or a worker-local lane.4445## Choose One Lane4647Load one primary reference first. Follow its links only when the task reaches48that boundary; do not preload whole clusters.4950| Task | Read first |51|---|---|52| Native greenfield service | [NATIVE-GREENFIELD](references/NATIVE-GREENFIELD.md) |53| Brownfield Tokio migration | [BROWNFIELD-MIGRATION](references/BROWNFIELD-MIGRATION.md) |54| Exact Tokio compatibility or quarantine boundary | [COMPAT-BOUNDARY](references/COMPAT-BOUNDARY.md) |55| Cx-aware high-level web handler patterns | [GREENFIELD-PATTERNS](references/GREENFIELD-PATTERNS.md) |56| Runtime, cancellation, shutdown, or local tasks | [RUNTIME-CONTROLS](references/RUNTIME-CONTROLS.md) |57| Channels, locks, or combinators | [PRIMITIVES-AND-ORCHESTRATION-CHOOSER](references/PRIMITIVES-AND-ORCHESTRATION-CHOOSER.md) |58| Observability, diagnostics, metrics, or OTLP | [OBSERVABILITY-FORENSICS](references/OBSERVABILITY-FORENSICS.md) |59| HTTP, gRPC, or high-level web routing | [WEB-GRPC-HTTP](references/WEB-GRPC-HTTP.md) |60| Database, messaging, filesystem, process, or signal work | [DB-MESSAGING-FS-PROCESS](references/DB-MESSAGING-FS-PROCESS.md) |61| Protocol or low-level networking work | [NETWORKING-PROTOCOL-STACK](references/NETWORKING-PROTOCOL-STACK.md) |62| Lab replay, DPOR, or escaped concurrency defect | [TESTING-FORENSICS](references/TESTING-FORENSICS.md) |63| Supervision or OTP-style components | [SUPERVISION-OTP](references/SUPERVISION-OTP.md) |64| Browser or Wasm integration | [BROWSER-WASM](references/BROWSER-WASM.md) |65| Distributed execution or rigor | [DISTRIBUTED-AND-RIGOR](references/DISTRIBUTED-AND-RIGOR.md) |66| RaptorQ or ATP security, transfer, or benchmark evidence | [RAPTORQ-DISTRIBUTED](references/RAPTORQ-DISTRIBUTED.md) |67| Work inside Asupersync, release it, or assess API compatibility | [REPO-CONTRIBUTOR-GUIDE](references/REPO-CONTRIBUTOR-GUIDE.md) |68| Diagnose an error or uncertain support claim | [TROUBLESHOOTING](references/TROUBLESHOOTING.md) |6970Use browser/Wasm, QUIC/H3, messaging, distributed, or RaptorQ lanes only when71requirements call for them.7273## Non-Negotiables7475- Do **not** treat Asupersync as an executor swap.76- Put `&Cx` first in async APIs you control.77- Use `Scope` and child regions for owned work. Avoid detached background tasks.78- Use `Cx::spawn` / `Cx::spawn_in` for ordinary region-owned task creation.79 `Scope::spawn_registered` is a lower-level boot/test path for callers already80 holding `&mut RuntimeState`.81- Add `cx.checkpoint()` in loops, retry bodies, long handlers, and shutdown-sensitive code.82- Prefer cancel-aware primitives and two-phase effects.83- State the layered v0.4.4-v0.4.9 cancellation contract precisely: ordinary `Cx::spawn*`84 preserves a typed result returned after cancellation acknowledgement (a85 concurrent abort no longer erases it), but pre-first-poll cancellation and86 cancellation-blind late values keep v0.4.3 task-level cancellation, and87 `JoinSet`, cancellation-dominant combinators, blocking wrappers, and88 low-level state tasks retain their separately tested policies. Neither89 "abort always wins" nor "the value always survives" is correct. Explicit90 cancellation wakes timer-parked native tasks; `Sleep` retires its registration91 and completes with `()` while timeout/deadline combinators retain outcome92 classification. Native worker tests, not Lab-only models, prove this boundary.93- `Cx::spawn_local` requires a worker-local lane owned by the same runtime. A94 current-thread runtime installs that lane on the caller during `block_on`,95 so its root `Cx` accepts `!Send` local tasks. A context from another runtime96 or a harness without a local lane still returns `LocalSchedulerUnavailable`97 (ASUP-E004). For other runtime flavors, enter an owner worker with98 `runtime.block_on(runtime.handle().spawn(async { ... }))` and obtain99 `Cx::current()` there. Cancellation evidence must prove the local task100 reached the parked state before aborting it.101- Use deterministic tests as part of normal development, not as optional polish.102- Treat `Cx::for_testing()` and `Cx::for_request()` as test/internal harness103 paths, not production architecture.104- Keep Tokio and Tokio-only crates behind explicit adapter modules if you must keep them at all.105- `asupersync-tokio-compat` adapts selected traits and context; it does not install a Tokio runtime106 or prove `Handle::current()`-dependent frameworks.107 Require downstream compile and runtime evidence for every bridge.108109## Migration Workflow1101111. Inventory direct and transitive Tokio-ecosystem dependencies.1122. Classify each as native replacement, explicit compat holdout, or deliberate113 workaround.1143. Use the repository's migration readiness planner when available; do not115 confuse a `cargo tree` grep with a plan.1164. Replace bootstrap, thread `&Cx` through owned APIs, then replace detached117 spawning with region-owned work.1185. Migrate time, sync, I/O, channel, web, database, and protocol slices one at119 a time.1206. Add deterministic and native cancellation tests during the migration.1217. Compile actual external-consumer feature profiles; `cfg(test)` access and122 repo-internal tests are not downstream API evidence.1238. Remove each compat boundary when its last justified dependency is gone.124125The planner's `summary.final_verdict`, `proof_pack.proof_commands`,126`semantic_map.recommendations`, and `operator_report.phase_plan` are inputs to127the decision. `scripts/audit-target.sh` is only bounded inventory; its optional128Cargo graph probe is explicit and can touch Cargo state.129130From the repository root, use `scripts/migration_readiness_planner.py`:131132```bash133python3 scripts/migration_readiness_planner.py --dry-run --scenario tokio-http-service134python3 scripts/migration_readiness_planner.py --project-root /path/to/rust/project --output-root target/migration-readiness135python3 scripts/migration_readiness_planner.py --execute --output-root target/migration-planner-fixtures136```137138`--execute` runs the planner's fixture scenarios; it does not execute the139generated proof commands or establish downstream runtime correctness.140141For more-than-parity design:142[LEVERAGE-PLAYBOOK](references/LEVERAGE-PLAYBOOK.md),143[BUDGET-OUTCOME-CAPABILITIES](references/BUDGET-OUTCOME-CAPABILITIES.md),144[SUPERVISION-OTP](references/SUPERVISION-OTP.md), and145[ADVANCED-FEATURES](references/ADVANCED-FEATURES.md).146147Other routers: [adoption](references/ADOPTION-LANES.md),148[anti-patterns](references/ANTI-PATTERNS.md),149[compat bridge](references/COMPAT-BRIDGE.md),150[replacement matrix](references/TOKIO-REPLACEMENT-MATRIX.md),151[performance](references/PERFORMANCE-AND-SCHEDULING.md),152[browser frameworks](references/BROWSER-FRAMEWORKS.md), and153[mathematics](references/MATHEMATICAL-FOUNDATIONS.md).154155Secondary deep dives, only when a primary card routes there (except the two156direct routes named above):157[greenfield patterns](references/GREENFIELD-PATTERNS.md),158[Tokio mappings](references/TOKIO-MAPPING.md),159[compat limits](references/COMPAT-BOUNDARY.md),160[scheduler internals](references/SCHEDULER-INTERNALS.md),161[channel/sync internals](references/CHANNELS-SYNC-INTERNALS.md),162[lock ordering](references/LOCK-ORDERING.md),163[support classes](references/STACK-SURFACES.md),164[Lab/DPOR](references/LAB-TRACE-DPOR.md), and165[error taxonomy](references/ERROR-TAXONOMY.md).166167## Proof and Repository Rules168169- Run the host formatter, compiler, linter, and tests; verify cancellation,170 shutdown, and resource release, not compilation alone.171- For an escaped concurrency defect, reproduce the same public API sequence on172 the native runtime, prove the formerly failing parked/owned state, assert the173 exact nested result and cleanup, and retain old-red/new-green evidence. A174 Lab-only or compile-only test is not a substitute.175- RCH pre-admission refusal, exit 103, worker assignment, a job id, a PID, or176 local fallback means **zero admissible executed tests**. Green proof requires177 terminal output naming the target and nonzero pass counts from the required178 environment.179- Do not key source or evidence authority to `/dp`, `/data/projects`, or an RCH180 checkout prefix. Identify the repository by content and declared root.181- Never invoke a waker, user callback, observer, or extension hook while a182 runtime-state lock is held. Treat unresolved tracker rows as unshipped183 boundaries, not capability claims; refresh them from the status card and live184 tracker before reporting current state.185- Exact `ForcedSchedule` files are bounded Lab replay evidence, not production186 scheduler control, authenticity proof, or automatic minimization.187- Support classes come from live implementation and proof: default production,188 optional production, experimental/guarded, compat-only, test/fuzz-only, or189 planned. Do not promote a class from prose alone.190191Inside Asupersync, follow live `AGENTS.md` and `TESTING_FOR_AGENTS.md`; work on192`main`, do not delete files without permission, and preserve the v0.4.3 public193API and documented behavior throughout 0.4.x. Classify proof through194`artifacts/proof_lane_manifest_v1.json` and195`artifacts/proof_status_snapshot_v1.json`: manifest = command/claim/envelope;196snapshot = freshness/blockers; only a terminal receipt proves execution.197Preserve build id, target/artifact roots, and dirty-tree state. Use Beads and198CASS for rationale, corroborated by tagged source and focused evidence.199200ATP performance claims require live ledger/matrix artifacts, tuned rsync,201release `atp`, symmetric crypto, caps, and SHA/tamper checks. A cell proves only202its scope; compilation or `sha_ok` is not a benchmark win.203204## Skill Validation205206After editing this package run:207208```bash209./scripts/validate.sh210ASUPERSYNC_SOURCE_ROOT=/path/to/asupersync ./scripts/validate.sh211```212213The second form also validates referenced repository paths and release-sensitive214source anchors. It does not compile Asupersync or replace RCH proof.215If the `sw` skill is installed elsewhere, set `ASUPERSYNC_SKILL_VALIDATOR` to216its `sw/scripts/validate-skill.py` path for either command.