whatisgithub

What is stata-cli?

ashuigordon/stata-cli — explained in plain English

Analysis updated 2026-05-18

41PythonAudience · researcherComplexity · 3/5LicenseSetup · moderate

In one sentence

A command line wrapper around Stata that lets humans and AI agents run statistical commands fast, with structured JSON output.

Mindmap

mindmap
  root((stata-cli))
    What it does
      Runs Stata from terminal
      Daemon for fast execution
      Structured JSON output
    Tech stack
      Python
      PyStata
      Stata
    Use cases
      AI agent regressions
      Fast repeated commands
      Do file automation
    Audience
      Researchers
      Data scientists
      AI agents

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Let an AI agent run Stata regressions and read results as structured JSON.

USE CASE 2

Speed up repeated Stata commands during a research session using daemon mode.

USE CASE 3

Run .do files, view datasets, and export graphs from a terminal instead of Stata's GUI.

What is it built with?

PythonPyStataStata

How does it compare?

ashuigordon/stata-clihsy23/clif-co-orchestrating-llm-inference-serving-and-fine-tuning.ant-research/memdreamer
Stars414142
LanguagePythonPythonPython
Setup difficultymoderatehardhard
Complexity3/55/55/5
Audienceresearcherresearcherresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires an existing licensed Stata 17+ installation, the tool itself does not include Stata.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

So what is it?

stata-cli is a command line tool that lets you run Stata, a statistics and econometrics program, from a terminal instead of its usual graphical interface. It works through PyStata, Stata's official Python library, and is designed for both human users and AI agents that need to call Stata programmatically. You can run Stata code directly, execute whole .do script files, view the current dataset, browse Stata's built in help topics, and export graphs, all through simple commands. A key feature is its daemon mode, which keeps Stata running in the background so each command executes in well under a tenth of a second, compared to two or three seconds when starting Stata fresh each time. This matters most for AI agents issuing many small commands in a row. The tool also returns results in structured JSON format on request, which makes it easier for an AI agent or another program to read the output automatically, and it ships with a SKILL.md file so agent tools like Claude can use it with no extra setup. Beyond running code, stata-cli can retrieve stored statistical results after commands like regress or summarize, read Stata matrices, inspect variable metadata and value labels, get or set Stata macros, and list Stata frames, the tool's term for multiple datasets held in memory at once. To use it you need Stata 17 or newer already installed and licensed on your machine, along with Python 3.9 or newer. It installs with a single pip or npm command, and after installing you first run a detect command to confirm your Stata installation is found, then start the daemon before running commands. It is released under the MIT license, and the project also ships a Chinese language translation of its documentation.

Copy-paste prompts

Prompt 1
Help me install stata-cli and confirm it detects my existing Stata license with the detect command.
Prompt 2
Show me how to start the daemon and run a regression, then read the results as JSON.
Prompt 3
Explain how to use stata-cli's SKILL.md so an AI agent can call Stata correctly.
Prompt 4
Walk me through retrieving e() and r() stored results after running a regress command.

Frequently asked questions

What is stata-cli?

A command line wrapper around Stata that lets humans and AI agents run statistical commands fast, with structured JSON output.

What language is stata-cli written in?

Mainly Python. The stack also includes Python, PyStata, Stata.

What license does stata-cli use?

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

How hard is stata-cli to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is stata-cli for?

Mainly researcher.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.