Vekrun Competitive Engineering

One problem. Multiple solutions.Let the evidence decide.

Build competing implementations from the same starting point. Verify them independently. Compare correctness, performance, cost and complexity. Choose the approach that earns its place in your codebase.

Same starting point · Same requirements · Independent evidence

Engineering outcome

Prevent duplicate payment processing

  • acme/portal
  • Pinned at e93d1c7
  • Processed once
  • Concurrent duplicates
  • Interrupted retries
  • Existing behaviour

The Coordinator proposed three materially different approaches

  1. Database uniquenessEnforce event uniqueness transactionally.

    CodexOwn environment · own branch

    Verified · 4 of 4
  2. Distributed lockingCoordinate concurrent deliveries using a shared lock.

    Claude CodeOwn environment · own branch

    2 of 4 · not eligible
  3. Durable event ledgerRecord processed events in persistent state.

    Vekrun agentOwn environment · own branch

    Verified · 4 of 4

Evidence comparison

Evidence for each candidate
EvidenceABC
Required criteria4 of 42 of 44 of 4
Change size160 lines127 lines437 lines
p95 per workload run5.91 s5.37 s4.88 s
Model spending$4.20$2.10 + 3 unpriced$2.90

What the evidence supports

No clear winner

A is the smaller change. C is faster and cheaper to build. B failed two required criteria, so it can’t be recommended.

Your decision. Every candidate stays on record with its evidence.

Don’t predict which approach is better. Build them. Prove them. Choose with evidence.

Engineering decisions deserve more than opinions

What if you could build both approaches before deciding?

Ask which approach is better and you get a confident answer. Build it, and you learn its trade-offs once it’s in your codebase. Competitive Engineering turns the alternatives into real implementations you can verify, measure and compare first.

Ask for a recommendation

Which approach should we use to speed up product search?

“I’d recommend caching. It should improve performance.”

Caching is implementedThe recommendation becomes the plan.

Trade-offs found after shippingShoppers see prices up to 60 seconds old.

Build both and compare

Which approach should we use to speed up product search?

A · Query optimizationBuilt and verified

B · CachingBuilt and verified

A
Faster under the workload · results always current
B
Fastest under the workload · prices up to 60 s old

Trade-offs understood before choosingYou pick the one that fits, with the evidence in hand.

Hypothetical alternatives become real implementations you can review, measure and keep.

Same starting point. Same rules.

A fair comparison begins before implementation.

Every candidate starts from the same pinned commit with the same goal and the same acceptance criteria, agreed before anything is built. The criteria describe behaviour you can observe, so none of them favours one design. Nobody declares a winner by changing the rules afterwards.

Starting revision

e93d1c7acme/portal · main

Pinned. Every candidate starts here.

Engineering goal

Prevent duplicate payment processing

Shared acceptance contractRequired

  1. A payment event is processed only once
  2. Concurrent deliveries cannot duplicate a charge
  3. Retries after interruption remain safe
  4. Existing payment behaviour is preserved

Agreed before any candidate is built. Observable behaviour, never one approach’s design.

Optional measurementsWhen you ask

  • Time per workload run, p50 and p95
  • Behaviour invariant
  • Rollback rehearsal

They inform the comparison. They never stand in for a required criterion.

  1. Independent buildDatabase uniqueness

    • e93d1c7
    • Same 4 criteria
  2. Independent buildDistributed locking

    • e93d1c7
    • Same 4 criteria
  3. Independent buildDurable event ledger

    • e93d1c7
    • Same 4 criteria

Explore fundamentally different solutions

Different approaches. Not different variable names.

The Coordinator proposes approaches that differ where it matters: algorithms, data structures, architectural boundaries, query strategies and dependencies. Use it for performance, reliability, refactoring, architecture and complex features, not just generating code.

Engineering goal

Prevent duplicate payment processing

  1. Database uniquenessEnforce event uniqueness transactionally.

    Differs in: Data model

  2. Distributed lockingCoordinate concurrent deliveries using a shared lock.

    Differs in: Coordination · new dependency

  3. Durable event ledgerRecord processed events in persistent state.

    Differs in: Architecture boundary

New in this approachAlready in your codebase

Build independently. Compare objectively.

Three isolated implementations. One engineering decision.

Each candidate is its own Factory Work Item, with its own branch, environment and verification. They run at the same time when resources allow, your working copy stays exactly as it was, and no candidate can touch another’s work.

Your working copye93d1c7 · acme/portal

Unchanged
  1. Database uniqueness

    CodexVekrun agent

    vekrun/ce-14-a

    Own environment from e93d1c7

    1. Prepare
    2. Implement
    3. Verify
    • db/migrate/add_event_id_index.rb
    • app/models/payment_event.rb
    • app/jobs/charge_job.rb

    Verified · 4 of 4

  2. Distributed locking

    Claude CodeVekrun agent

    vekrun/ce-14-b

    Own environment from e93d1c7

    1. Prepare
    2. Implement
    3. Verify
    • config/lock_service.yml
    • app/services/event_lock.rb
    • app/jobs/charge_job.rb

    2 of 4 · evidence kept

  3. Durable event ledger

    Vekrun agentVekrun agent

    vekrun/ce-14-c

    Own environment from e93d1c7

    1. Prepare
    2. Implement
    3. Verify
    • db/migrate/create_event_ledger.rb
    • app/ledger/event_ledger.rb
    • app/ledger/replayer.rb
    • app/jobs/charge_job.rb

    Verified · 4 of 4

No candidate can see or change another candidate’s work.

Explore the AI Factory

Correctness comes before everything else

The fastest solution is worthless if it doesn’t work.

Every candidate is checked independently against the same contract. A candidate can pass its own tests and still fail a required behaviour, and when it does, it can’t be recommended, however fast, cheap or small it is. Its evidence stays for you to learn from. Select any result to see the evidence behind it.

Required acceptance criteria, checked independently for each candidate. Select a result to see its evidence.
Required criteriaADatabase uniquenessBDistributed lockingCDurable event ledger
A payment event is processed only once
Concurrent deliveries cannot duplicate a charge
Retries after interruption remain safe
Existing payment behaviour is preserved
Verified4 of 42 of 44 of 4
Eligible for recommendationEligibleNot eligibleEligible

Eligible for recommendation

Every required criterion has independent verification evidence, and its Proof Pack is intact.

  • Processed once500 replayed deliveries · each processed once
  • Concurrent duplicates50 simultaneous duplicates · 1 charge
  • Interrupted retriesWorker stopped mid-charge, retried · charged once
  • Existing behaviourPayment suite · 284 tests passing

Proof Pack · 4 of 4 criteria · its own tests: 284 tests passing

Not eligible for recommendation

Its own 284 tests pass, but two required behaviours fail. However fast, cheap or small it is, it can’t be recommended. Its evidence stays available.

  • Processed once500 replayed deliveries · each processed once
  • Concurrent duplicates50 simultaneous duplicates · 2 charges
  • Interrupted retriesLock expired while a worker stalled · charged twice
  • Existing behaviourPayment suite · 284 tests passing

Proof Pack · 2 of 4 criteria, failures recorded · its own tests: 284 tests passing

Eligible for recommendation

Every required criterion has independent verification evidence, and its Proof Pack is intact.

  • Processed once500 replayed deliveries · each processed once
  • Concurrent duplicates50 simultaneous duplicates · 1 charge
  • Interrupted retriesWorker stopped mid-charge, replayed · charged once
  • Existing behaviourPayment suite · 284 tests passing

Proof Pack · 4 of 4 criteria · its own tests: 291 tests passing

Optional measurements Not part of eligibility

Time per workload run
AMeasured
BMeasured
CMeasured
Peak-traffic load
ANot measured
BNot measured
CNot measured

Compare engineering evidence, not confidence

Every approach earns its scorecard.

Verification, spending, change size, architecture impact, measured run times, invariants, rollback rehearsals and duration, side by side for two or three candidates. No invented score out of 100: select a measurement to see where it comes from and whether it shapes the recommendation.

Engineering comparison

Evidence for each candidate. Select a measurement to see where it comes from.
EvidenceADatabase uniquenessBDistributed lockingCDurable event ledger
Verification
VerifiedNot verifiedVerified
4 of 42 of 44 of 4
IntactFailures recordedIntact
Spending
$4.20$2.10 known$2.90 (clearly better)
None3 callsNone
Change
160 lines · +142 −18 (clearly better)127 lines · +118 −9437 lines · +396 −41
5411
1 added1 added · new lock dependency4 added · new Ledger component
001
000
Measured under the workload
5.18 s4.68 s4.39 s
5.91 s5.37 s4.88 s (clearly better)
202020
2,0002,0002,000
HeldHeldHeld
YesYesYes
For information
18 min12 min26 min

Used by the recommendation

Change size

Lines added plus lines removed. Smaller is preferred when everything else is equal, and it decides under the smallest-change priority.

From: Git

Two implementations qualify. A has the smaller change. C is faster under the workload and cheaper to build. Your priorities decide which trade-off is better.

Future Simulation

Measure the consequences before committing to the change.

Don’t just ask whether an optimization will make your software faster. Measure it. When you ask, the same repeatable workload runs against the original code and every candidate, with an invariant that holds on the original and must stay unchanged, and a rollback rehearsed on a disposable copy. Let Vekrun draft the workload, or bring your own benchmark.

Webhook burst with duplicates

Same fixture · same measurement · repeated runs

Replay 2,000 payment webhooks, 20% delivered twice, 50 at a time.

A synthetic copy of the payments tables: 25,000 customers and their invoices.

One worker pool, the production database engine, network latency simulated at 5 ms.

20 timed repetitions per revision, each one burst of 2,000 deliveries

bin/bench webhooks --deliveries 2000 --duplicates 0.2 --concurrency 50 --repeat 20script/benchmarks/webhook_burst.sh --runs 20

Valid payment amounts and invoice totals stay exactly as they were.

Apply the change, undo it on the disposable copy, then rerun the payment suite and the invariant.

Vekrun drafted this workload from the goal. Edit any part before it runs.Your commands, fixtures and assumptions, run exactly as you wrote them.

Time per repetition · one dot per run

  1. Original · e93d1c720 of 20 runs

    p50 6.42 sp95 8.51 sInvariant held

  2. A · Database uniqueness20 of 20 runs

    p50 5.18 sp95 5.91 sInvariant held

  3. B · Distributed locking20 of 20 runs

    p50 4.68 sp95 5.37 sInvariant held

  4. C · Durable event ledger20 of 20 runs

    p50 4.39 sp95 4.88 sInvariant held

Rollback rehearsalon a disposable copy

  1. Apply the change
  2. Undo it
  3. Rerun the suite and invariant
  4. Rollback demonstrated

Results hold for this workload and these conditions. A rehearsal shows the change can be undone as tested, not that every production rollback is safe.

The best solution depends on what matters to you

Engineering is full of trade-offs. Make them explicit.

Choose a priority and see how the recommendation responds. Balanced recommends only a clear winner; lower cost and smaller changes resolve a trade-off your way. Every step of the reasoning is shown, and the final choice is always yours.

What matters most?

ADatabase uniqueness

Verified · 4 of 4

Recommended

CDurable event ledger

Verified · 4 of 4

Recommended

What the recommendation compares, and which candidate is clearly better on each measure
MeasureACResult
Change size160 lines437 linesA clearly smaller
Possible unresolved callers00Equal
p95 per workload run5.91 s4.88 sC clearly faster
Known model spending$4.20$2.90C clearly cheaper
Execution duration18 min26 minFor information only

Differences within 10% count as equal, so a tiny gap never decides a winner.

What the evidence supports

No clear winner

Both qualify, and each is clearly better somewhere: A is the smaller change, C is faster and cheaper. Neither is at least as good on everything, so the decision is yours.

Recommended: C

C is clearly cheaper to build: $2.90 against $4.20. That resolves the trade-off. A stays available.

Recommended: A

A is clearly the smaller change: 160 lines against 437. That resolves the trade-off. C stays available.

Whatever the priority, you make the final choice.

No forced winners. No false confidence.

Sometimes the right answer is neither.

Plenty of tools have a confident answer for everything. Vekrun recognizes when the evidence doesn’t justify one: if nothing qualifies, there’s no recommendation, and if the trade-offs are real, the decision stays with you.

Prevent duplicate payment processing

ADatabase uniqueness

Verified

  • 4 of 4 criteria
  • 160 lines

BDistributed locking

Required check failed

  • 2 of 4 criteria
  • Concurrent duplicates failed

Recommended: A

The only candidate verified against every required criterion. B’s evidence stays available for review.

Reduce product search latency

AQuery optimization

Verified

  • 4 of 4 criteria
  • 96 lines · p95 1.20 s · $1.80

CSearch index

Verified

  • 4 of 4 criteria
  • 410 lines · p95 1.12 s · $1.90

Recommended: A

A is clearly the smaller change. Time per run and spending are within 10% of each other, so they count as equal. A is at least as good on everything and better on one.

Prevent duplicate payment processing

ADatabase uniqueness

Verified

  • 4 of 4 criteria
  • 160 lines · p95 5.91 s · $4.20

CDurable event ledger

Verified

  • 4 of 4 criteria
  • 437 lines · p95 4.88 s · $2.90

No clear winner

A is the smaller change; C is faster and cheaper. Each is clearly better somewhere, so Vekrun leaves the decision to you, or to the priority you set.

Simplify order processing

AService extraction

Required check failed

  • 3 of 4 criteria
  • Refunds changed behaviour

CEvent-driven workflow

Required check failed

  • 3 of 4 criteria
  • An order lost after interruption

No recommendation

Neither implementation meets every required criterion, so Vekrun doesn’t pick one. Both stay available with their evidence for further investigation.

Improve an approach using what the competition discovered

The first comparison can inform a better second attempt.

An approach that fails can still teach something. Before you decide, revise one candidate once: it’s rebuilt fresh from the same commit with the first round’s findings and verified again on its own. A controlled second attempt within your budget, not an endless optimization loop.

Round one

  1. ADatabase uniqueness

    Verified

  2. BDistributed locking

    Failed concurrency checks

    Kept, with useful findings

  3. CDurable event ledger

    Verified

Revise one approach, onceRevision round 1 of 1

What round one established: The lock expired while a worker stalled, so a second delivery charged again.

B2Distributed locking, revised

Takes the lock inside the charge’s transaction and rejects stale workers.

A fresh implementation from e93d1c7, not a patch on B

Independently verified · 4 of 4

Known spending$11.60of $12.00+ 3 calls with unknown prices

B2 joins the comparison. B, A and C stay on record with their evidence. A revision can fail too; it’s checked exactly like the first round. B’s unpriced calls stay listed, never counted as $0.

You’re in control of the experiment

Explore alternatives without giving up control of spending.

Decide how much a technical decision is worth investigating: how many approaches, whether to measure performance and a spending limit for the whole comparison. When recorded spending reaches the limit, candidates still running stop, and everything already proven is kept.

Configure your comparison

Number of approaches

Known spending $9.20of $12.00

  1. ADatabase uniquenessFinished · evidence kept

    Factory run+ Workload$4.20

  2. BDistributed lockingFinished · evidence kept

    Factory run+ Workload$2.10 + 3 calls unpriced

  3. CDurable event ledgerFinished · evidence kept

    Factory run+ Workload$2.90

Every candidate finished with $9.20 in known spending, plus 3 calls with unknown prices, within the $12.00 limit. Each has its evidence.

No clear winner: A is clearly smaller; C is clearly faster and cheaper. The decision is yours.

Each candidate is a complete Factory run, so more alternatives mean more execution and potentially more model spending. The limit acts on recorded spending: calls with unknown prices are listed, never counted as $0, and each Work Item’s own spending controls still apply.

Keep the decision. Remember the alternatives.

Never have the same architectural debate twice.

Your choice becomes an approved decision in Engineering Memory, with the comparison, the alternatives you considered, their evidence and your reasoning. Future developers and every agent can see why the code is the way it is, and what was already tried.

Comparison CE-14 · your choice

Choosing doesn’t merge or deploy anything. A selected implementation continues through your usual review, delivery and permissions; keeping all or choosing none sends nothing to delivery.

Engineering decision

Approach A selected: database uniqueness for payment idempotency

Approved decision · chosen by the developer

Selected
Implementation and its Proof Pack · 4 of 4
Alternatives considered
  • B · Distributed locking · failed 2 required criteria
  • C · Durable event ledger · verified, not chosen
Reasoning
Smallest verified change, with no new component to run.
Comparison
Comparison CE-14 · evidence for every candidate

Engineering Memory

The next time someone asks how payments avoid duplicates, Vekrun and every agent start from this comparison: what was decided, and the approaches already tried.

Explore Engineering MemoryHow the AI Factory delivers

When should you use Competitive Engineering?

When there’s more than one good answer, and choosing wrong is expensive.

Most tasks need one well-verified implementation. Build alternatives when a decision has several plausible solutions and the cost of picking the wrong one is significant.

  • Performance optimization

    Compare query strategies, caching and alternative algorithms under the same workload.

  • Architecture decisions

    Evaluate service boundaries, design patterns and implementation strategies with working code.

  • Reliability improvements

    Compare concurrency controls, retry strategies and failure handling under the same checks.

  • Complex refactoring

    Find the approach that preserves existing behaviour with the fewest unnecessary changes.

  • New features

    Evaluate competing implementations before one becomes part of a mature codebase.

  • Infrastructure trade-offs

    See when a solution brings new dependencies or more to operate, before you commit to it.

Vekrun Competitive Engineering

Opinions propose solutions.Engineering builds them.Evidence informs the decision.

Build. Verify. Compare. Choose.

  1. CouncilChallenges and refines the plan
  2. Competitive EngineeringBuilds and compares alternatives
  3. AI FactoryExecutes the engineering work
  4. Proof PacksEstablish the evidence
  5. Engineering MemoryKeeps the decisions
  6. PR GuardianLooks after the delivered change

Questions.

What is Competitive Engineering?

A way to make engineering decisions with evidence instead of predictions. Vekrun builds two or three materially different implementations of the same goal from the same commit, verifies each one independently against the same acceptance criteria, measures the trade-offs and lets you choose.

How is it different from asking multiple AI agents for suggestions?

Suggestions are opinions about code that doesn’t exist. Competitive Engineering builds the code: every approach is implemented in its own environment, checked against the same requirements and compared on recorded evidence, so you’re choosing between working implementations, not arguments.

Can I compare two or three approaches?

Yes. The Coordinator proposes two or three materially different approaches, differing in algorithms, data structures, architectural boundaries, query strategies or dependencies, not variable names.

Do the approaches start from the same code?

Yes. Every candidate starts from the same pinned Git commit and gets the same goal and acceptance criteria, agreed before any of them is built. Each runs as its own Factory Work Item and none can change another’s work.

Can I use Claude Code and Codex?

Yes. Candidates can be built by Claude Code, Codex, Vekrun’s own agent or the models you choose, and one agent can build all of them. The competition is between approaches, not providers.

How are implementations independently verified?

Each candidate is checked by Vekrun against every required criterion, with tests, concurrency and recovery checks and browser runs where they apply, and gets its own Proof Pack. An agent saying it’s done, or its own tests passing, is never treated as verification.

Can Vekrun measure performance before and after a change?

Yes, when you ask. The same repeatable workload runs against the original code and each candidate, up to 30 times each. Every repetition records one timing, and p50 and p95 come from those timings. A behaviour invariant that holds on the original must stay unchanged, and a rollback is rehearsed on a disposable copy, where the invariant is checked again. Results hold for that workload and those conditions.

Can I supply my own benchmark?

Yes. Let Vekrun draft the workload from your goal, or bring your own benchmark commands, fixtures, assumptions, repetitions, invariants and rollback steps.

How does Vekrun recommend an approach?

Only verified candidates are eligible. Among them, Vekrun compares change size (lines added plus lines removed), possible unresolved callers, p95 time per workload run where both were measured and known model spending where comparable, treating differences within 10% as equal. Balanced recommends only a clear winner; the cost and smallest-change priorities resolve trade-offs their way. Execution duration is shown for information and never decides.

What happens if none of the implementations qualifies?

There’s no recommendation. Vekrun doesn’t manufacture a winner: every candidate and its evidence stays available, and you decide what to try next.

Can I improve one candidate after the first comparison?

Yes, once. After the first candidates finish and before you decide, you can revise one approach. The revision is a fresh implementation from the same commit, informed by what the comparison found, and it’s verified like any other candidate. It runs within the remaining budget and can fail too.

Can I control the total spending?

Yes. Set a spending limit for the whole comparison. Vekrun tracks recorded spending across every candidate and stops the ones still running when the limit is reached, keeping completed evidence. Calls with unknown prices are listed, never counted as free, and each Work Item’s own controls still apply.

What happens to the alternatives?

They’re kept. When you choose a candidate, the decision is recorded in Engineering Memory with the comparison, the alternatives and their evidence, and your reasoning if you add it. You can also retain every approach, or take no recommendation: the comparison is recorded as complete, nothing is marked as selected and nothing moves to delivery.

Does choosing an approach automatically merge the code?

No. Choosing records the decision. The chosen implementation continues through your usual review and delivery workflow, under the same permissions as any other change.

Is Competitive Engineering included in Vekrun Free?

Yes. It’s part of Vekrun Free with your choice of AI, with no separate subscription. Each candidate is a full Factory run, so model provider and execution costs, billed by your providers, grow with the number of approaches you build.

Vekrun Competitive Engineering

Build alternatives.Measure the trade-offs.Choose with evidence.

Make engineering decisions with independently verified implementations, not hypothetical recommendations.

Included in Vekrun Free · Your choice of AI · Model and infrastructure costs are billed by your providers.