Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Clojure
  3. scope-capture

scope-capture

MITClojure

A Clojure(Script) library that saves and restores local runtime environments at the REPL for easier debugging and exploration.

GitHubGitHub
600 stars14 forks0 contributors

What is scope-capture?

Scope-capture is a Clojure and ClojureScript library that helps developers save and restore the local runtime environment of their code at the REPL. It solves the tedious problem of manually recreating variable contexts during debugging by capturing snapshots when code executes, allowing instant replay for investigation.

Target Audience

Clojure and ClojureScript developers who use REPL-driven workflows, particularly those debugging complex functions, onboarding to new projects, or exploring unfamiliar codebases.

Value Proposition

Developers choose scope-capture because it automates environment recreation, reducing manual effort and errors. Its unique selling point is enabling context restoration after just one code execution, making debugging more immediate and accessible.

Overview

Project your Clojure(Script) REPL into the same context as your code when it ran

Use Cases

Best For

  • Debugging Clojure functions with many local variables
  • Exploring unfamiliar codebases without deep project knowledge
  • REPL-driven development with breakpoint-like pausing
  • Onboarding new developers to Clojure projects
  • Running one-off queries in the context of existing code
  • Interactive experimentation with captured runtime scopes

Not Ideal For

  • Projects that rely solely on graphical debuggers with step-through interfaces and watch windows
  • ClojureScript applications with complex, stateful browser REPLs where code site ID management is cumbersome
  • Production deployments or shared development environments where global variable pollution from defsc poses risks
  • Teams seeking a zero-configuration, drop-in debugging tool without modifying user profiles or local setups

Pros & Cons

Pros

Effortless Context Capture

sc.api/spy and sc.api/brk macros automatically save local environments during code execution, eliminating manual variable recreation as shown in the basic usage example.

Flexible Scope Restoration

Offers multiple restoration methods: sc.api/letsc for local bindings and sc.api/defsc for global vars, catering to different REPL workflows and editor integrations.

Interactive Breakpoint Simulation

sc.api/brk pauses execution and allows resumption from the REPL with override values via sc.api/loose-with!, enabling step-through debugging without external tools.

Beginner-Friendly Onboarding

Lowers the barrier for new developers by enabling mechanical environment recreation without deep project knowledge, as emphasized in the rationale section.

Cross-Platform Support

Works with both Clojure and ClojureScript, including browser-connected REPLs, though with specific caveats for ClojureScript usage.

Cons

ClojureScript Complexity

Requires explicit code site IDs in ClojureScript (e.g., sc.api/letsc [7 -3]), which is non-intuitive and error-prone, as admitted in the README's caveats.

Installation Friction

Must be added to user profiles (e.g., ~/.lein/profiles.clj) rather than project dependencies, complicating setup and team-wide adoption compared to simple dependency management.

Global Namespace Pollution

sc.api/defsc overwrites global vars with captured locals, risking conflicts with existing definitions and making it unsuitable for shared or production-like environments.

Limited Dynamic Var Automation

Dynamic vars require manual declaration for capture (e.g., :sc/dynamic-vars option), adding boilerplate and potential for missed bindings in complex applications.

Frequently Asked Questions

Quick Stats

Stars600
Forks14
Contributors0
Open Issues12
Last commit1 year ago
CreatedSince 2017

Tags

#clojurescript#repl#tooling#repl-tools#clojure#live-programming#development-tools#debugging#breakpoints

Built With

C
Clojure
C
ClojureScript

Included in

Clojure2.8k
Auto-fetched 1 day ago

Related Projects

lein-figwheellein-figwheel

Figwheel builds your ClojureScript code and hot loads it into the browser as you are coding!

Stars2,875
Forks205
Last commit2 years ago
ultraultra

A Leiningen plugin for a superior development environment

Stars1,235
Forks34
Last commit3 years ago
prettypretty

Library for helping print things prettily, in Clojure - ANSI fonts, formatted exceptions

Stars623
Forks29
Last commit2 months ago
spyscopespyscope

Trace-oriented debugging tools for Clojure

Stars587
Forks35
Last commit6 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub