spacequery
spacequeryv0.4.0MIT
Named queries over the state of one developer's machine: which coding agents run where, which repositories are dirty, which worktrees and sessions sit idle.
Install
npm install spacequeryspacequery gives a coding agent one current view of a developer’s machine. Before an agent edits, starts a server, opens a pull request, or takes over old work, it needs to know who and what already occupies the machine and the repository. git, gh, process tools, and terminal sessions each show one slice of that. spacequery observes those sources, called providers, joins their rows in a fresh in-memory SQLite database, prints the result, and exits. It reads the sources and never changes them.
Features
Section titled “Features”- Reports for a repository and for the work.
spacequery hereshows the other agents in the repository, the git state, linked worktrees, the branch’s pull request, listening ports, local processes, Docker containers, and mise tools, among other sections.spacequery workputs unclosed project issues, herdr agents with their session models, and recent local Cursor agents in one report, andspacequery watch workrefreshes it. - Questions across tools. spacequery joins rows by repository root, so
agents-in-dirty-repos,failing-checks-with-agents,idle-worktrees, andservers-with-agentsare each one named query.heavy-processesranks every process by CPU and memory and names the herdr pane that owns it. When ad hoc--sqldoes not prepare, the error names the fix, such as the close column or the table a missing column lives in. - A gate before work. Queries that list agents leave out the caller.
spacequery here --expect-empty --strictfails when another agent is in the repository or a provider did not answer, andspacequery watch in-dir --until emptywaits until the repository is free. - Gaps that show. The default output is JSON, and its
providersfield givessource,ok,observed_at,ms, anderrorfor each provider that ran. A failed provider leaves its tables empty, so empty rows beside it mean unknown, not none.spacequery doctorchecks which built-in providers answer. - Only the providers a query needs. A query loads the providers for the tables it reads, so
tools-in-dirdoes not call GitHub, and independent providers load concurrently. Optional providers such asbrew,runtag, andfirstlightstay out of the short--helplist until~/.config/spacequery/config.jsonenables them. Every call starts from an empty database, so no cache can go stale. - A terminal browser.
spacequery uishows the tables, queries, and reports with their columns and SQL, and fetches rows when you pressr.--tsvprints a compact table for a person.
How an agent uses it
Section titled “How an agent uses it”The workflow lives in the spacequery skill, which gh skill install puts on each agent host.
- Before work starts in a repository, the agent runs
spacequery here. - It reads
section_statusto see whether the providers behind each section answered. - It picks a safer next action from the rows. It waits with
spacequery watch in-dir --until emptywhen another agent works there, reuses an idle worktree, avoids a port that a local server holds, or reads failing checks before it asks to merge.
Getting started
Section titled “Getting started”spacequery needs Node 24.10 or later, and the tools it observes on PATH, such as git, gh, herdr, docker, and lsof.
npm install -g spacequeryspacequery herespacequery doctorgh skill install meganemura/spacequery spacequery --scope user --agent claude-codeWorks with
Section titled “Works with”- runtag writes job files, and spacequery reads them.
spacequery watch runs-in-dir --root <repo> --until status=exitedwaits until every job in the repository has exited. - spacequery reads the state that firstlight writes for each check run.
running-checkslists the checks still running under a live supervisor, andlatest-check-runsgives each repository’s latest result. - The
polylinedbprovider reads unclosed project issues from polylinedb throughpd, forissues,here, andwork.