From 1210dd899c33dbf09517ecb3ef500e46d64f8334 Mon Sep 17 00:00:00 2001 From: Artyom Date: Thu, 29 Oct 2026 00:32:37 +0300 Subject: [PATCH] Carry over the agent context and openspec history from lab 4 Bring the Claude Code settings, the lint hook, the opsx commands and skills, the architecture notes, the lab 1 to lab 4 specs and the archived lab 1 to lab 4 changes into the lab 5 skeleton, so lab 5 continues the same spec history instead of starting from scratch. The files come from the lab 4 solution commit d2744bc. Rewrite AGENTS.md and the openspec context and rules for lab 5: upload answers 202 queued after the original is in a private staging prefix and the attachment, the job and the outbox row are committed in one transaction, a separate relay publishes the outbox to RabbitMQ with publisher confirms, a separate worker built from the same image consumes the queue through FastStream with a manual ack after the result commit, PostgreSQL stays the source of truth for job states, Out of scope moves to labs 6-7, track 1 and broker HA, and the rules add the failure windows between PostgreSQL and the broker, the effect key and the lease to specs and designs. Co-Authored-By: Claude Opus 5.5 (1M context) --- .claude/commands/opsx/apply.md | 181 +++++++++ .claude/commands/opsx/archive.md | 225 +++++++++++ .claude/commands/opsx/explore.md | 193 ++++++++++ .claude/commands/opsx/propose.md | 145 ++++++++ .claude/commands/opsx/sync.md | 258 +++++++++++++ .claude/commands/opsx/update.md | 87 +++++ .claude/hooks/lint-python.sh | 45 +++ .claude/settings.json | 17 + .claude/skills/openspec-apply-change/SKILL.md | 185 ++++++++++ .../skills/openspec-archive-change/SKILL.md | 182 +++++++++ .claude/skills/openspec-explore/SKILL.md | 308 ++++++++++++++++ .claude/skills/openspec-propose/SKILL.md | 149 ++++++++ .claude/skills/openspec-sync-specs/SKILL.md | 262 +++++++++++++ .../skills/openspec-update-change/SKILL.md | 91 +++++ .gitignore | 8 + AGENTS.md | 61 +++ .../.openspec.yaml | 4 + .../2026-09-29-add-lab1-messenger/design.md | 177 +++++++++ .../2026-09-29-add-lab1-messenger/proposal.md | 38 ++ .../specs/lab1-event-publication/spec.md | 102 +++++ .../specs/lab1-inmemory-capacity/spec.md | 60 +++ .../specs/lab1-messenger-chats/spec.md | 85 +++++ .../specs/lab1-messenger-history/spec.md | 106 ++++++ .../specs/lab1-messenger-identity/spec.md | 84 +++++ .../specs/lab1-service-operability/spec.md | 164 ++++++++ .../2026-09-29-add-lab1-messenger/tasks.md | 94 +++++ .../.openspec.yaml | 5 + .../design.md | 66 ++++ .../proposal.md | 37 ++ .../tasks.md | 47 +++ .../.openspec.yaml | 5 + .../design.md | 104 ++++++ .../proposal.md | 39 ++ .../specs/lab1-event-publication/spec.md | 48 +++ .../specs/lab1-inmemory-capacity/spec.md | 16 + .../specs/lab1-messenger-chats/spec.md | 32 ++ .../specs/lab1-messenger-history/spec.md | 21 ++ .../specs/lab1-messenger-identity/spec.md | 58 +++ .../specs/lab1-service-operability/spec.md | 56 +++ .../specs/lab2-auth-sessions/spec.md | 123 ++++++ .../specs/lab2-persistent-storage/spec.md | 76 ++++ .../tasks.md | 52 +++ .../.openspec.yaml | 4 + .../design.md | 62 ++++ .../proposal.md | 34 ++ .../specs/lab2-dependency-failures/spec.md | 37 ++ .../specs/lab2-history-index/spec.md | 24 ++ .../specs/lab2-session-cache/spec.md | 56 +++ .../tasks.md | 38 ++ .../.openspec.yaml | 4 + .../design.md | 83 +++++ .../proposal.md | 34 ++ .../specs/lab1-service-operability/spec.md | 21 ++ .../specs/lab2-dependency-failures/spec.md | 21 ++ .../specs/lab3-failover-operations/spec.md | 85 +++++ .../tasks.md | 35 ++ .../.openspec.yaml | 4 + .../design.md | 102 +++++ .../proposal.md | 33 ++ .../specs/lab1-messenger-history/spec.md | 43 +++ .../specs/lab1-service-operability/spec.md | 64 ++++ .../specs/lab2-persistent-storage/spec.md | 58 +++ .../specs/lab3-idempotent-messages/spec.md | 81 ++++ .../specs/lab3-load-balancing/spec.md | 84 +++++ .../tasks.md | 43 +++ .../.openspec.yaml | 4 + .../design.md | 155 ++++++++ .../proposal.md | 36 ++ .../specs/lab1-messenger-history/spec.md | 108 ++++++ .../specs/lab2-persistent-storage/spec.md | 34 ++ .../specs/lab3-idempotent-messages/spec.md | 40 ++ .../specs/lab3-load-balancing/spec.md | 10 + .../specs/lab4-attachments/spec.md | 153 ++++++++ .../specs/lab4-object-storage/spec.md | 47 +++ .../tasks.md | 56 +++ .../.openspec.yaml | 4 + .../design.md | 103 ++++++ .../proposal.md | 32 ++ .../specs/lab4-attachments/spec.md | 15 + .../specs/lab4-object-storage/spec.md | 39 ++ .../specs/lab4-upload-resilience/spec.md | 80 ++++ .../tasks.md | 40 ++ openspec/config.yaml | 180 +++++++++ .../notes/architecture-patterns-python.md | 349 ++++++++++++++++++ openspec/specs/lab1-event-publication/spec.md | 102 +++++ openspec/specs/lab1-messenger-chats/spec.md | 85 +++++ openspec/specs/lab1-messenger-history/spec.md | 141 +++++++ .../specs/lab1-messenger-identity/spec.md | 50 +++ .../specs/lab1-service-operability/spec.md | 175 +++++++++ openspec/specs/lab2-auth-sessions/spec.md | 123 ++++++ .../specs/lab2-dependency-failures/spec.md | 43 +++ openspec/specs/lab2-history-index/spec.md | 24 ++ .../specs/lab2-persistent-storage/spec.md | 86 +++++ openspec/specs/lab2-session-cache/spec.md | 56 +++ .../specs/lab3-failover-operations/spec.md | 85 +++++ .../specs/lab3-idempotent-messages/spec.md | 91 +++++ openspec/specs/lab3-load-balancing/spec.md | 84 +++++ openspec/specs/lab4-attachments/spec.md | 153 ++++++++ openspec/specs/lab4-object-storage/spec.md | 52 +++ openspec/specs/lab4-upload-resilience/spec.md | 80 ++++ 100 files changed, 8061 insertions(+) create mode 100644 .claude/commands/opsx/apply.md create mode 100644 .claude/commands/opsx/archive.md create mode 100644 .claude/commands/opsx/explore.md create mode 100644 .claude/commands/opsx/propose.md create mode 100644 .claude/commands/opsx/sync.md create mode 100644 .claude/commands/opsx/update.md create mode 100755 .claude/hooks/lint-python.sh create mode 100644 .claude/settings.json create mode 100644 .claude/skills/openspec-apply-change/SKILL.md create mode 100644 .claude/skills/openspec-archive-change/SKILL.md create mode 100644 .claude/skills/openspec-explore/SKILL.md create mode 100644 .claude/skills/openspec-propose/SKILL.md create mode 100644 .claude/skills/openspec-sync-specs/SKILL.md create mode 100644 .claude/skills/openspec-update-change/SKILL.md create mode 100644 AGENTS.md create mode 100644 openspec/changes/archive/2026-09-29-add-lab1-messenger/.openspec.yaml create mode 100644 openspec/changes/archive/2026-09-29-add-lab1-messenger/design.md create mode 100644 openspec/changes/archive/2026-09-29-add-lab1-messenger/proposal.md create mode 100644 openspec/changes/archive/2026-09-29-add-lab1-messenger/specs/lab1-event-publication/spec.md create mode 100644 openspec/changes/archive/2026-09-29-add-lab1-messenger/specs/lab1-inmemory-capacity/spec.md create mode 100644 openspec/changes/archive/2026-09-29-add-lab1-messenger/specs/lab1-messenger-chats/spec.md create mode 100644 openspec/changes/archive/2026-09-29-add-lab1-messenger/specs/lab1-messenger-history/spec.md create mode 100644 openspec/changes/archive/2026-09-29-add-lab1-messenger/specs/lab1-messenger-identity/spec.md create mode 100644 openspec/changes/archive/2026-09-29-add-lab1-messenger/specs/lab1-service-operability/spec.md create mode 100644 openspec/changes/archive/2026-09-29-add-lab1-messenger/tasks.md create mode 100644 openspec/changes/archive/2026-10-12-typed-boundary-schemas/.openspec.yaml create mode 100644 openspec/changes/archive/2026-10-12-typed-boundary-schemas/design.md create mode 100644 openspec/changes/archive/2026-10-12-typed-boundary-schemas/proposal.md create mode 100644 openspec/changes/archive/2026-10-12-typed-boundary-schemas/tasks.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/.openspec.yaml create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/design.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/proposal.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/specs/lab1-event-publication/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/specs/lab1-inmemory-capacity/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/specs/lab1-messenger-chats/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/specs/lab1-messenger-history/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/specs/lab1-messenger-identity/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/specs/lab1-service-operability/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/specs/lab2-auth-sessions/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/specs/lab2-persistent-storage/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-postgres-sessions/tasks.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-session-cache-and-resilience/.openspec.yaml create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-session-cache-and-resilience/design.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-session-cache-and-resilience/proposal.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-session-cache-and-resilience/specs/lab2-dependency-failures/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-session-cache-and-resilience/specs/lab2-history-index/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-session-cache-and-resilience/specs/lab2-session-cache/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab2-session-cache-and-resilience/tasks.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-failover-operations/.openspec.yaml create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-failover-operations/design.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-failover-operations/proposal.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-failover-operations/specs/lab1-service-operability/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-failover-operations/specs/lab2-dependency-failures/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-failover-operations/specs/lab3-failover-operations/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-failover-operations/tasks.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-load-balanced-replicas/.openspec.yaml create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-load-balanced-replicas/design.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-load-balanced-replicas/proposal.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-load-balanced-replicas/specs/lab1-messenger-history/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-load-balanced-replicas/specs/lab1-service-operability/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-load-balanced-replicas/specs/lab2-persistent-storage/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-load-balanced-replicas/specs/lab3-idempotent-messages/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-load-balanced-replicas/specs/lab3-load-balancing/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab3-load-balanced-replicas/tasks.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab4-image-attachments/.openspec.yaml create mode 100644 openspec/changes/archive/2026-10-28-add-lab4-image-attachments/design.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab4-image-attachments/proposal.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab4-image-attachments/specs/lab1-messenger-history/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab4-image-attachments/specs/lab2-persistent-storage/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab4-image-attachments/specs/lab3-idempotent-messages/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab4-image-attachments/specs/lab3-load-balancing/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab4-image-attachments/specs/lab4-attachments/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab4-image-attachments/specs/lab4-object-storage/spec.md create mode 100644 openspec/changes/archive/2026-10-28-add-lab4-image-attachments/tasks.md create mode 100644 openspec/changes/archive/2026-10-29-add-lab4-upload-resilience/.openspec.yaml create mode 100644 openspec/changes/archive/2026-10-29-add-lab4-upload-resilience/design.md create mode 100644 openspec/changes/archive/2026-10-29-add-lab4-upload-resilience/proposal.md create mode 100644 openspec/changes/archive/2026-10-29-add-lab4-upload-resilience/specs/lab4-attachments/spec.md create mode 100644 openspec/changes/archive/2026-10-29-add-lab4-upload-resilience/specs/lab4-object-storage/spec.md create mode 100644 openspec/changes/archive/2026-10-29-add-lab4-upload-resilience/specs/lab4-upload-resilience/spec.md create mode 100644 openspec/changes/archive/2026-10-29-add-lab4-upload-resilience/tasks.md create mode 100644 openspec/config.yaml create mode 100644 openspec/notes/architecture-patterns-python.md create mode 100644 openspec/specs/lab1-event-publication/spec.md create mode 100644 openspec/specs/lab1-messenger-chats/spec.md create mode 100644 openspec/specs/lab1-messenger-history/spec.md create mode 100644 openspec/specs/lab1-messenger-identity/spec.md create mode 100644 openspec/specs/lab1-service-operability/spec.md create mode 100644 openspec/specs/lab2-auth-sessions/spec.md create mode 100644 openspec/specs/lab2-dependency-failures/spec.md create mode 100644 openspec/specs/lab2-history-index/spec.md create mode 100644 openspec/specs/lab2-persistent-storage/spec.md create mode 100644 openspec/specs/lab2-session-cache/spec.md create mode 100644 openspec/specs/lab3-failover-operations/spec.md create mode 100644 openspec/specs/lab3-idempotent-messages/spec.md create mode 100644 openspec/specs/lab3-load-balancing/spec.md create mode 100644 openspec/specs/lab4-attachments/spec.md create mode 100644 openspec/specs/lab4-object-storage/spec.md create mode 100644 openspec/specs/lab4-upload-resilience/spec.md diff --git a/.claude/commands/opsx/apply.md b/.claude/commands/opsx/apply.md new file mode 100644 index 00000000..31c4fa24 --- /dev/null +++ b/.claude/commands/opsx/apply.md @@ -0,0 +1,181 @@ +--- +name: "OPSX: Apply" +description: "Implement tasks from an OpenSpec change (Experimental)" +allowed-tools: Bash(openspec:*) +category: "Workflow" +tags: ["workflow", "artifacts", "experimental"] +--- + +Implement tasks from an OpenSpec change. + +**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store ` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `view`). Once selected, treat `--store ` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "" --json --store ""`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root. + +**Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes. + +**Steps** + +1. **Select the change** + + If a name is provided, use it. Otherwise: + - Infer from conversation context if the user mentioned a change + - Auto-select if only one active change exists + - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one + + Always announce: "Using change: " and how to override (e.g., `/opsx:apply `). + +2. **Check status to understand the schema** + ```bash + openspec status --change "" --json + ``` + Parse the JSON to understand: + - `schemaName`: The workflow being used (e.g., "spec-driven") + - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints + - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others) + +3. **Get apply instructions** + + ```bash + openspec instructions apply --change "" --json + ``` + + This returns: + - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs) + - Progress (total, complete, remaining) + - Task list with status + - Dynamic instruction based on current state + - Optional `context`: current required project instruction input from the selected root + - Optional `operationGuidance`: current advisory guidance for apply + + **Handle states:** + - If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue` (if it is not installed, run `openspec status --change "" --json` to see the next artifact and `openspec instructions --change "" --json` for how to create it) + - If `state: "all_done"`: congratulate, suggest archive + - Otherwise: proceed to implementation + + Treat `context` as a required prompt-level input. Read and consider it, and + apply relevant project facts, conventions, and constraints while implementing. + Treat `operationGuidance` as optional additive advice. Read and consider every + entry, and follow entries that are applicable and compatible with the built-in + workflow. + + Keep both fields separate from CLI-returned state, missing artifacts, tasks, + progress, `contextFiles`, and the built-in `instruction`. They are not + evidence of task completion, do not replace the built-in instruction, and do + not permit bypassing a blocked state. If context conflicts with the built-in + instruction, an explicit user choice, or a CLI-controlled value, report the + conflict and preserve the controlling value. If guidance is inapplicable or + conflicts with those controlling inputs, do not follow it and explain why. + These are prompt-level behavior contracts, not enforceable checks. + +4. **Read context files** + + Read every file path listed under `contextFiles` from the apply instructions output. + The files depend on the schema being used: + - **spec-driven**: proposal, specs, design, tasks + - Other schemas: follow the contextFiles from CLI output + + Do not copy `context` or `operationGuidance` verbatim into implementation + files or planning artifacts unless the user separately asks for that content. + +5. **Show current progress** + + Display: + - Schema being used + - Progress: "N/M tasks complete" + - Remaining tasks overview + - Dynamic instruction from CLI + +6. **Implement tasks (loop until done or blocked)** + + For each pending task: + - Show which task is being worked on + - Make the code changes required + - Keep changes minimal and focused + - Mark task complete in the tasks file: `- [ ]` → `- [x]` + - Continue to next task + + **Pause if:** + - Task is unclear → ask for clarification + - Implementation reveals a design issue → suggest updating artifacts + - Error or blocker encountered → report and wait for guidance + - User interrupts + +7. **On completion or pause, show status** + + Display: + - Tasks completed this session + - Overall progress: "N/M tasks complete" + - If all done: suggest archive + - If paused: explain why and wait for guidance + +**Output During Implementation** + +``` +## Implementing: (schema: ) + +Working on task 3/7: +[...implementation happening...] +✓ Task complete + +Working on task 4/7: +[...implementation happening...] +✓ Task complete +``` + +**Output On Completion** + +``` +## Implementation Complete + +**Change:** +**Schema:** +**Progress:** 7/7 tasks complete ✓ + +### Completed This Session +- [x] Task 1 +- [x] Task 2 +... + +All tasks complete! You can archive this change with `/opsx:archive`. +``` + +**Output On Pause (Issue Encountered)** + +``` +## Implementation Paused + +**Change:** +**Schema:** +**Progress:** 4/7 tasks complete + +### Issue Encountered + + +**Options:** +1.