Design a feature Exercise 5 of 9
Draft the design
Turn the decisions from your brief into a document another engineer can implement. Work in the same Elephant chat.
- Select
egm-draftand give it the saved path toconcepts_brief.md. Ask for the finalized design atdocs/designs/retry-delivery.mdand point it at the current source and tests. Use the brief to resolve conflicts that arise as the skill reads the code. - Open
design_draft.mdat the returned path. Use the section checkpoints to confirm the problem and goals, technical plan, alternatives, and implementation plan. For example, ask the agent to turn “retry transient errors” into a condition a developer can implement and test. - Check that your technical plan defines the replay signal, attempt limit, outcome on exhaustion, and batch order. Ask for Markdown links to the source and test files, relative to the final design file.
- Ask the skill to finalize the design at the specified path. Resolve any differences it flags between the draft and the brief. Open the finalized file and follow the local links.
You're done when the expected outputs for success, an ambiguous failure, and exhaustion can all be derived from the saved design alone.
Reference answer
One version of the technical plan for
docs/designs/retry-delivery.md:
- Iterate events serially. A successful send yields
{ id, status: "delivered" }. - When the first send throws or rejects with a value whose
replaySafeproperty is strictlytrue, send that same event once more. The sender may set this flag when it can establish that the first attempt had no receiver-side effect. An unknowable outcome such as a lost acknowledgement is ineligible for replay. - A failure without that signal, or any failure on the second attempt,
yields
{ id, status: "failed" }. Continue with the next event. - Keep
deliverBatch(events, send), the result shape, and input ordering.
Under ## Detailed Implementation Plan, link
../../src/delivery/deliver-batch.mjs and
../../test/deliver-batch.test.mjs from the final design location. Describe
the retry loop and specify test cases for success, safe replay succeeding,
safe replay exhausting the budget, and ambiguous failure. Include assertions
on call sequence so returning the right status after extra sends still
fails a test.
If your brief chose a different retry budget, the technical plan, examples, and tests should all reflect that same budget. Draft skill