AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Distributed Step Lock

skill-hsienw-ai-agent-engineering-playbook-distributed-step-lock · by HsienW

Design and review distributed locks for agent step transitions. Use when preventing concurrent workers, duplicate resumes, retries, compensation, or external requests from mutating the same task or step state at the same time.

No reviews yet
0 installs
0 views
view→install

Install

$ agentstack add skill-hsienw-ai-agent-engineering-playbook-distributed-step-lock

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-hsienw-ai-agent-engineering-playbook-distributed-step-lock)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
16d ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Distributed Step Lock? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Distributed Step Lock

Skill Interface

  • Name: distributed-step-lock.
  • Description: Design and review distributed locks for agent step transitions when concurrent workers, duplicate resumes, retries, compensation, or external requests may mutate the same task or step state at the same time.
  • Parameters: Step identifier, lock owner, TTL, transition guard, allowed state transition, lock store behavior, retry policy, failure behavior, event names, and concurrency verification cases.
  • Instructions: Use this skill before changing shared task or step state from multiple runtimes. Acquire a lock, verify owner on release and extension, use compare-and-swap as a second guard, define TTL behavior, and test contention, expiry, owner mismatch, and lock store outage.

Idempotency prevents duplicate side effects for the same key. It does not by itself prevent two workers from racing on the same step transition. Use a lock plus a durable compare-and-swap guard.

Lock Interface

type StepLock = {
  acquire(stepId: string, owner: string, ttlMs: number): Promise;
  release(stepId: string, owner: string): Promise;
  extend(stepId: string, owner: string, ttlMs: number): Promise;
};

type StepTransitionGuard = {
  transition(
    stepId: string,
    from: StepStatus,
    to: StepStatus,
    owner: string
  ): Promise;
};

Rules

  • Acquire the lock before changing step state.
  • Use owner identity when releasing or extending a lock.
  • Use a TTL so crashed workers do not create permanent locks.
  • Renew the lock for long-running steps.
  • Reject release attempts from a different owner.
  • Use a database compare-and-swap transition as a second line of defense.
  • Emit structured events for lock acquired, contended, extended, released, and

expired.

Failure Behavior

  • Lock unavailable: return a retryable concurrency result or wait according to

policy.

  • Lock expired during work: stop mutation or revalidate ownership before

committing.

  • Durable transition mismatch: do not overwrite; reload state and decide the

next action.

  • Lock store unavailable: degrade according to safety policy, usually by

rejecting mutation rather than allowing unsafe concurrency.

Verification

Test two concurrent workers, owner mismatch on release, TTL expiry after worker crash, lock extension, transition compare-and-swap failure, lock store outage, compensation racing with normal flow, and resume racing with retry.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.