AWS Builder Center

Merge Lab: A Linter for Your Teammates' Unpushed Decisions

When teammates split a feature, the second developer waits hours for decisions that were actually settled in minutes — a problem AI coding agents make worse by confidently guessing wrong. Here's how we built a deterministic rule engine on Lambda, DynamoDB, and Bedrock to catch that drift before it happens.

The problem nobody names

Two developers split a feature.
The second one can't really start—not because they're waiting for the first person's code, but because they're waiting for three tiny decisions: which HTTP client got picked, what the function is called, and what shape it returns.
Those decisions usually happen in the first five minutes of a coding session.
The implementation takes the next three hours.
Today, Git is the only channel those decisions travel through. Until someone pushes, everyone else is coding with incomplete context. Three hours of waiting for information that stopped changing almost immediately.
AI coding agents make this sharper, not softer.
An agent can generate five hundred lines in ten minutes. It'll be internally consistent, confident, and quietly incompatible with whatever another agent decided on the next desk. Every new session starts from zero—re-picking libraries, re-inventing names, and recreating conventions that were already settled an hour earlier.
That gap between decision made and decision shared is the problem we kept running into.

Where the idea came from

We hit it twice.
The first time was during a hackathon. Two of us split adjacent parts of the same feature, and by the time we merged, we'd independently invented different names for the same concepts.
The second time was during an LFX mentorship. Same pattern. Nobody was blocked on implementation—they were blocked on invisible decisions living inside someone else's working tree.
That's where Merge Lab started.

What Merge Lab actually does

Merge Lab runs a small CLI on every developer's machine.
Instead of waiting for a commit, it watches the working tree—including uncommitted and untracked files—and publishes declarations only.
That means:
  • exported function signatures
  • data shapes
  • dependency names
  • route paths
  • environment variable names
It never sends source code. It never uploads literal values. It never touches secrets.
When another developer's AI agent starts a session, a  SessionStart  hook injects those contracts directly into its context. The agent begins with the decisions the team has already made.
If it drifts anyway, a  PreToolUse  hook catches it before the write happens.
Instead of generating conflicting code and discovering it later, the agent gets a one-line reason:
Route  /api/users  already exists on another branch.
Or:
 fetchClient  is already the shared HTTP wrapper.
The agent rewrites its own output, and the developer never has to intervene.

Why the blocking stays deterministic

One design decision mattered more than anything else.
The system that says "no" cannot be an opinion.
Every block comes from one of six deterministic rules:
  • Dependency conflict
  • Naming drift
  • Duplicate symbol
  • Route collision
  • Shape mismatch
  • Stale binding
No language model sits in that enforcement path.
If a developer asks why something was blocked, the answer should be reproducible tomorrow, on another machine, against the same repository.
That predictability became more important than cleverness.

The AWS architecture

Every service ended up being load-bearing. Nothing exists just because it looked good on an architecture diagram.

AWS Lambda

Six Lambda functions power the backend:
  •  ingest 
  •  context 
  •  verdict 
  •  board 
  •  auth 
  •  semantic 
Developer traffic is naturally bursty.
A session starts with a flurry of requests, then nothing happens for hours. Lambda's scale-to-zero matches that traffic pattern almost perfectly.
The  verdict  function lives separately because it sits in front of every AI write with a hard 300 ms latency budget. Keeping its deployment package tiny mattered more than raw compute.

Amazon API Gateway

Everything sits behind a single HTTP API Gateway.
We skipped REST API entirely because we didn't need its extra features, and HTTP APIs are both cheaper and faster for this workload.

Amazon DynamoDB

We designed the access patterns before writing the schema.
That one decision simplified everything else.
Contracts live under keys like:
 PK = REPO#<repo>   SK = CONTRACT#<symbol>#v<version> 
Fetching every active contract becomes a single query instead of a scan.
Versioning stays idempotent through a stable shape hash, so publishing unchanged work doesn't create unnecessary writes—even though the CLI publishes constantly during active coding sessions.

Amazon Bedrock

Bedrock is the only place a model enters the system.
And it can never block anyone.
After the deterministic checks pass, an asynchronous Lambda compares declarations across branches for probable duplicate intent under different names—things like  formatDate  versus  toDisplayDate .
Those findings always appear as warnings with confidence scores.
Suggestions.
Never verdicts.
Caching comparisons by shape-hash pairs means identical work never gets analyzed twice.

AWS SAM

The entire infrastructure lives inside one  template.yaml .
That became surprisingly valuable.
Six functions, one table, one API, every IAM role, and every permission are reviewable in a single file.
We also learned the hard way that SAM's default esbuild builder doesn't play nicely with pnpm's  workspace:  protocol. Switching to the Makefile build method solved it, but only after digging through builder behavior rather than finding a clear explanation in the docs.

AWS Amplify Hosting

The dashboard is a React + Vite app deployed through Amplify.
Push to GitHub.
Get a new deployment.
Inject the API URL during build.
Exactly the amount of deployment complexity we wanted.

Amazon CloudWatch

CloudWatch ended up solving problems we didn't know we had.
Every request logs structured JSON with repository, branch, route, and latency.
Those logs caught a handler that happily returned HTTP 200 while quietly writing contracts under the wrong key shape—a bug our tests never surfaced.

IAM

Permissions stay intentionally narrow.
Each Lambda has its own execution role.
Only the  semantic  function can invoke Bedrock.
Authentication itself is intentionally simple right now: workspace bearer tokens validated inside each handler instead of a Cognito authorizer. It was a conscious hackathon tradeoff, and we'd rather document it than pretend otherwise.

What worked better than expected

The biggest surprise wasn't DynamoDB.
It was designing around access patterns first.
Once those six query patterns existed, the table almost designed itself. Zero scans, stable versioning, and idempotent publishing became natural consequences instead of later optimizations.
Lambda's event-driven model also felt unusually well matched to developer workflows. This wasn't "serverless because it's cheaper." It was serverless because developers generate bursts of activity followed by long stretches of silence.
SAM being the single source of truth made infrastructure reviews dramatically simpler too.
Running  sam deploy  and seeing an exact changeset before deployment gave us confidence that nothing unexpected was about to disappear.

What fought us the whole way

SAM's build tooling caused more friction than the application code.
The default  NodejsNpmEsbuildBuilder  runs  npm install  inside every service directory.
That becomes a problem when your repository uses pnpm workspaces.
Instead of saying "this package manager isn't supported here," it fails with a cryptic dependency error that sends you looking in completely the wrong direction.
Changing to  BuildMethod: makefile  fixed it.
Finding that fix took reading builder internals.
Another rabbit hole appeared when  CodeUri  pointed at the repository root.
 sam build  tried copying the entire project—including pnpm's circular symlink structure—until the operating system hit filename length limits.
The fix?
 sam build --build-in-source .
Again, hidden in  --help , not where you'd expect it.
Then came the smaller paper cuts:
  •  sam deploy --guided  repeating authorization prompts for every API route.
  • Bedrock access sitting in a mysterious pending state for nearly thirty minutes during a hackathon.
  • Amplify correctly detecting pnpm while shipping an image that didn't actually include pnpm.
  • No deployment-time warning when bundled code references AWS services that the function's IAM role can't access.
None of them were catastrophic.
Together, they consumed far more time than writing the product itself.

Closing

Merge Lab isn't trying to replace code review.
It isn't trying to make AI agents smarter.
It's trying to eliminate a much smaller—and much more common—problem: the delay between when a decision gets made and when someone else's agent learns about it.
The blocking layer stays deterministic because developers deserve explanations they can reproduce.
The language model only whispers.
The rules decide when something can't happen.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article