{
  "format": "siebly-agent-implementation-manifest/v1",
  "id": "position-manager-core",
  "title": "Exchange State Management Agent Manifest",
  "task": "position-manager-core",
  "version": 1,
  "lastReviewed": "2026-05-03",
  "purpose": "Machine-readable implementation manifest for exchange state-management and position-manager runtimes.",
  "canonicalArtifacts": {
    "manifest": "https://siebly.io/.well-known/agent-manifests/position-manager-core/latest.json",
    "runtimeKit": "https://siebly.io/.well-known/runtime-kits/position-manager-core/v1/index.json",
    "runtimeTypes": "https://siebly.io/.well-known/runtime-kits/position-manager-core/v1/types.ts",
    "integrationKit": "https://siebly.io/.well-known/integration-kits/position-manager-core/latest.json",
    "conformancePack": "https://siebly.io/.well-known/conformance/position-manager-core/latest.json",
    "criticalPathGuide": "https://siebly.io/ai/position-manager/critical-path",
    "recipe": "https://siebly.io/.well-known/recipes/position-manager-critical-path.json",
    "schema": "https://siebly.io/.well-known/conformance/position-manager/v1/schema.json",
    "fixtures": "https://siebly.io/.well-known/conformance/position-manager/v1/fixtures.json",
    "runner": "https://siebly.io/.well-known/conformance/position-manager/v1/runner.ts"
  },
  "authorityOrder": [
    "Use this manifest before guide pages when building the runtime contract.",
    "Use the runtime kit to create the local module layout before runtime code.",
    "Use the conformance pack and runner contract to create local tests before runtime code.",
    "Use the integration kit for state machine, event routing, confirmation lifecycle, and phase rules.",
    "Use exchange overlays for SDK methods, request fields, private topics, and rejection codes.",
    "Use installed SDK declarations and exchange docs for exact method names and request shapes."
  ],
  "requiredFirstSteps": [
    "Create SOURCE_VERIFICATION.md before exchange calls.",
    "Create WORKFLOW_STATE_MACHINE.md, PRIVATE_EVENT_ROUTING_TABLE.md, CONFIRMATION_LIFECYCLE.md, and DURABLE_CONTEXT_LIFECYCLE.md before submitters.",
    "Create local modules from the runtime kit contracts.",
    "Generate local conformance tests from the required fixture set.",
    "Keep demo/live submission disabled until required checks pass."
  ],
  "buildPath": [
    "Read the critical workflow.",
    "Use the task manifest for generation.",
    "Implement the runtime kit module contracts.",
    "Generate tests from the required conformance pack.",
    "Implement the smallest manager that passes the required behavior checks before adding features.",
    "Use broad SDK docs only to verify method names and request shapes."
  ],
  "behaviorContract": {
    "architecture": "ws_symbol_side_phase_gated",
    "reusableArchitecture": "order_position_state_machine",
    "reusablePrimitives": [
      "custom-order-id-registry",
      "trusted-accountstate-boundary",
      "ws-first-order-state",
      "recovery-hydrate-replan",
      "dirty-scope-event-routing",
      "protective-sl-tp-dispatch",
      "mutation-confirmation-gating",
      "stale-mutation-noop-classification",
      "slot-convergence",
      "latch-lifecycle",
      "conformance-fixture-schema"
    ],
    "managerLane": "simple_managed_slots",
    "accountStateSource": "Use the account-state layer as the in-memory account view. Feed it startup REST snapshots and private account events. Local submission outcomes are provisional coordination evidence and pending-confirmation inputs, not trusted open-order state. Do not build a second account-state reducer.",
    "slotIdentity": "Use deterministic internal SlotKey values for strategy identity. Exchange-visible custom order IDs are opaque lookup keys into an order-context store. Treat ID drift as non-actionable when role, step, side, quantity, price, trigger, exit semantics, and order kind still match.",
    "customOrderIdRegistry": "Generate an opaque custom ID, store context keyed by that ID before submission, send the order with that ID, and look up context when private events return the ID. Apply exchange-specific prefix/length/character rules only where the SDK or exchange requires them.",
    "startupRecovery": "On startup, reconnect, or recovery, hydrate current state, manage orders proven app-owned by the runtime/persisted store, optionally clean unknown scoped orders only when explicit config enables it, wait for private stream confirmation or scoped recovery hydration, then rebuild expected slots from current positions.",
    "healthyStream": "After startup, healthy private account-event bursts are the normal convergence path: ingest private events into account state, emit semantic WS/accountstate logs, mark affected symbol-side scopes dirty, debounce/coalesce by symbol-side, plan from trusted account state, dispatch the selected phase, wait for private stream confirmation or scoped recovery hydration, then replan from stream-fed state.",
    "restBoundary": "REST hydration is for startup, reconnect, exception/gap, sync-required or not-ready state, rejected/unknown/conflicting submissions, and explicit recovery. It is not the ordinary per-event confirmation source.",
    "phaseGate": "Use the fixed ws_symbol_side_phase_gated phase order: recovery > cleanup > protective > dca > noop > blocked. Recovery/sync-required state hydrates first and blocks normal cleanup, protective, and DCA planning until trusted state is restored. A workflow pass may submit cleanup, protective, or DCA actions, but never more than one of those phases.",
    "protectiveDispatch": "For fresh protection, pre-register SL and TP contexts and dispatch the separate SL and TP orders concurrently by default. If serialized protective mode is configured, submit SL before TP. DCA remains gated until required protection is trusted.",
    "pendingConfirmations": "Accepted place/amend/cancel responses create pending confirmations and duplicate-submit protection. They may update local in-flight state for observability, but they do not make dependent phases eligible until the private stream or scoped recovery hydration confirms the account-state outcome.",
    "submissionTimeout": "Use a configurable bounded confirmation timeout for unknown REST/WS outcomes; 5 seconds is a reasonable generated simple-lane default. Unknown outcomes enter scoped recovery rather than duplicate submit or trusted success.",
    "slotConvergence": "Regular fixed-price TP and DCA LIMIT slots converge by slot identity, order side, quantity, and resting price after tick/lot normalization. Close-position or close-on-trigger SL slots converge by slot identity, order side, trigger price, trigger source, close-position semantics, and stop kind; hydrated quantity, price, reduce-only, and default false-like fields are diagnostic unless current exchange docs make them actionable. Exchange echo fields, generated order IDs, lifecycle counters, default booleans, omitted trigger-only fields on regular orders, and display-only precision differences must not trigger cancel/recreate churn.",
    "semanticWsLogs": "Emit semantic logs for private stream ingestion and account-state application: private_ws_event_received, accountstate_event_applied, symbol_side_dirty_marked, symbol_side_reconcile_started, phase_selected, submission_accepted_pending_confirmation, private_ws_confirmation_applied, workflow_reconcile_complete.",
    "advancedLane": "Durable lifecycle epochs, replacement generations, and cross-process adoption belong to an advanced persistent strategy lane only when explicitly requested and tested."
  },
  "requiredChecks": [
    "startup_hydrated_position_queues_work_before_service_ready",
    "private_event_marks_dirty_and_schedules_reconcile",
    "private_event_burst_debounces_until_quiet_window",
    "opaque_custom_id_registry_routes_exchange_echoes",
    "pending_confirmation_does_not_unlock_dependent_phase",
    "private_confirmation_before_rest_accept_is_consumed",
    "terminal_event_during_cancel_or_amend_is_benign_race",
    "reconnect_queues_known_scopes_for_recovery_even_when_quiet",
    "slot_filter_failures_are_blocked_not_silent_or_retried",
    "flat_position_cleans_app_owned_orders"
  ],
  "completeRequiredChecks": [
    "startup_hydrated_position_queues_work_before_service_ready",
    "private_event_marks_dirty_and_schedules_reconcile",
    "private_event_burst_debounces_until_quiet_window",
    "opaque_custom_id_registry_routes_exchange_echoes",
    "pending_confirmation_does_not_unlock_dependent_phase",
    "private_confirmation_before_rest_accept_is_consumed",
    "terminal_event_during_cancel_or_amend_is_benign_race",
    "reconnect_queues_known_scopes_for_recovery_even_when_quiet",
    "slot_filter_failures_are_blocked_not_silent_or_retried",
    "flat_position_cleans_app_owned_orders",
    "rest_acceptance_does_not_downgrade_trusted_private_order",
    "terminal_order_status_is_not_open_order_confirmation",
    "execution_fill_is_not_open_order_confirmation",
    "default_dca_active_order_does_not_advance_next_step",
    "startup_adopts_active_contexts_and_prunes_absent_contexts",
    "ambiguous_event_routes_bounded_fallback_then_exact_scope",
    "pending_confirmation_timeout_enters_scoped_recovery",
    "recovery_hydration_blocks_normal_phases_until_trust_restored",
    "configured_symbol_allowlist_blocks_out_of_scope_events",
    "dry_run_status_doctor_cannot_submit_live_orders"
  ],
  "exchangeOverlays": {
    "binance": "https://siebly.io/.well-known/agent-manifests/binance-position-manager/latest.json",
    "bybit": "https://siebly.io/.well-known/agent-manifests/bybit-position-manager/latest.json"
  }
}
