Agent skill

Shellm Architecture Reference

by laude-institute in laude-institute/headlong

Explains how shellm's bash-based recursive LLM shell fits together - its core engine, identity system, memory, skills and trajectory log.

Apache-2.0Auto-check: notesDevelopment

Install Shellm Architecture Reference

skills CLI
$ npx skills add laude-institute/headlong --skill shellm -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install laude-institute/headlong shellm --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/laude-institute/headlong.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/shellm .claude/skills/shellm && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
shellm
GitHub stars
1.2k
Token cost
~2k tokens
SKILL.md length
771 words
Files
1
Skills in repo
10
Repo updated
First seen
Licence
Apache-2.0

At a glance

Explains how shellm's bash-based recursive LLM shell fits together - its core engine, identity system, memory, skills and trajectory log.

  • Works in 7 steps: think step loads the think prompt… → Replaces {{identity_name}} and {{goals}}… → Appends recent traj context (last N… → …
  • Understanding how shellm's identity, memory and trajectory pieces fit together
  • SKILL.md covers Architecture overview, bin/ reference, Key environment variables and Identity directory layout, plus 3 more sections
  • Needs ANTHROPIC_API_KEY and OPENAI_API_KEY

What it does

This skill is a map of shellm, a set of composable bash scripts that turn an LLM into an autonomous agent living in a shell, stacked bottom to top from raw multi-provider LLM calls, through a recursive execute-in-shell loop, up to a step log and message assembly layer for multi-turn conversation. An agent activates one of several isolated identities by sourcing an activation script, which sets environment variables that every other tool then reads - there are no global config files.

It documents the core bin/ scripts by purpose: the shellm script itself runs the recursive loop that sends a prompt, executes returned bash code blocks, and feeds the output back until a FINAL marker is set; the llm script is a multi-provider CLI supporting Anthropic, OpenAI and Gemini with flags for model, system prompt, message JSON, streaming and thinking; the identity script manages isolated identities, each with its own memories, skills, kernel and trajectory; think, chat and focus manage one autonomous thinking cycle, the conversational message stream, and goal tracking; and mem is a file-based, markdown-plus-YAML memory store.

The file carries its own warning that it may be out of date and that the code under bin/ is the actual source of truth, directing anyone who finds a discrepancy to a separate skill-author skill to update it and open a pull request.

When your agent uses it

  • Understanding how shellm's identity, memory and trajectory pieces fit together
  • Debugging unexpected agent behavior inside the shellm system
  • Looking up which bin/ script handles a specific shellm capability

Example prompts

  • “Explain how shellm's identity activation sets up environment variables.”
  • “Which script handles the recursive execute-in-shell loop in shellm?”
  • “Debug why this shellm agent's memory search isn't returning results.”

Requirements

  • bash

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. think step loads the think prompt template from $IDENTITY_DIR/prompts/think.md
  2. Replaces {{identity_name}} and {{goals}} in the template
  3. Appends recent traj context (last N steps via traj tail)
  4. Calls shellm with this prompt — shellm executes bash, loops until FINAL
  5. Writes the resulting thought or action to traj
  6. If it was an action, forks a child branch, executes via shellm, merges back
  7. Dispatches thought processes (TPs) — each TP gets recent thoughts and can write to traj/mem

What it can do on your machine

Read from SKILL.md and the folder at commit d77aadd. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • ANTHROPIC_API_KEY
    • OPENAI_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Shellm Architecture Reference loads about 2k tokens when it runs. Until then it costs about 59 tokens; SKILL.md has 771 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~59
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:122
    .env                  (optional) identity-specific env vars

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from laude-institute/headlong at commit d77aadd, republished under its Apache-2.0 licence (© laude-institute). 771 words, ~1,989 tokens.

Download SKILL.mdSave it as .claude/skills/shellm/SKILL.md (or your agent's skills folder).
name
shellm
description
Reference for the shellm system — recursive LLM shell, identity management, memory, skills, trajectory, and all CLI tools. Use when working on shellm itself, debugging agent behavior, or understanding how the pieces fit together.

shellm

This skill may be out of date. The source of truth is always the code in bin/. If you find discrepancies, use the skill-author skill to update this file and open a PR.

Architecture overview

shellm is a set of composable bash scripts that turn an LLM into an autonomous agent living in a shell. The stack, bottom to top:

llm              raw LLM calls (Anthropic, OpenAI, Gemini)
shellm           recursive execute-in-shell loop on top of llm
traj / context   step log (DAG) + message assembly for multi-turn
mem / skills     persistent memory + learnable capabilities
identity         isolated agent identities (own mem, skills, traj)
think / chat     autonomous thinking + human conversation
focus            goal tracking

An agent activates an identity (source .identities/<name>/activate), which sets env vars. All tools read from those env vars — no global config files.

bin/ reference

Core engine
ScriptPurpose
shellmRecursive LLM-in-bash loop. Sends a prompt to the LLM, executes returned bash code blocks, feeds output back, repeats until FINAL is set. The heart of the system.
llmMulti-provider LLM CLI. llm [options] prompt or stdin. Supports Anthropic, OpenAI, Gemini. Key flags: -m MODEL, -s SYSTEM, -M MESSAGES_JSON, --stream, --thinking.
Identity & activation
ScriptPurpose
identityManage isolated identities. Each has its own memories, skills, kernel, traj. Subcommands: new, list, info, switch, delete, shell, prompt.

Activate an identity to set env vars for all other tools:

bash
source .identities/myagent/activate   # activate in current shell
deactivate_identity                    # undo
identity shell myagent                 # or: start a subshell
Thinking & conversation
ScriptPurpose
thinkOne autonomous think cycle. Reads traj + memories, calls shellm with think prompt, writes thought/action to traj, dispatches thought processes. think step [--dry-run].
chatSend messages into the thought stream. chat send <msg> appends a human-msg step. chat repl gives a readline loop.
focusGoal management. focus set <goal>, focus show, focus done <query>. Stores goals as mem entries with type=goal.
Memory & skills
ScriptPurpose
memFile-based memory store (markdown + YAML frontmatter). mem add --type TYPE <text>, mem search <query>, mem list, mem show <name>, mem forget <name>, mem edit <name> <text>.
skillsSkill management. skills install <src>, skills show <name>, skills promote <name> (to kernel), skills search <query>, skills remote add <path>.
Trajectory & context
ScriptPurpose
trajTrajectory operations (single-file and tree). Uses TRAJ_DIR + TRAJ_ID. traj new, traj append, traj tail, traj cat, traj fork, traj merge, traj show, traj list, traj root. show is unified: pass any ID (trajectory or step) and it searches all files in traj_dir.
contextReads traj, outputs a JSON messages array for llm -M. Maps step types to assistant/user roles. Key flags: --traj_dir, --tail N, --head N, --max-bytes, --pin <step_id>.
File utilities
ScriptPurpose
viewRead files with line numbers. view FILE [START[:END]].
globGit-aware glob matching sorted by mtime. glob PATTERN [DIR] [--limit N].
subExact-string substitution in files. sub FILE OLD NEW [--replace-all].
putAtomic file write from stdin. echo content | put FILE [--force].
Docker sandboxing
ScriptPurpose
shellm-dockerConstrained Docker facade for sandboxed execution. run, build, ps, logs, rm.
shellm-docker-brokerHost-side broker that manages Docker containers for sandboxed shellm envs.
shellm-explore(Not covered here — run exploration tool.)
Show full SKILL.md (325 more words)Show less

Key environment variables

These are set by source .identities/<name>/activate:

VariablePoints to
IDENTITY_NAMEIdentity name (e.g. "andy")
IDENTITY_DIRIdentity root dir (e.g. .identities/andy)
MEM_DIR$IDENTITY_DIR/memories
SKILLS_DIR$IDENTITY_DIR/skills
SKILLS_KERNEL_DIR$IDENTITY_DIR/kernel
TRAJ_DIR$IDENTITY_DIR/trajectories
TRAJ_IDUUID of root trajectory
SHELLM_TRAJ_DIRTrajectory directory (default $HOME/.shellm/trajectories)
SHELLM_ENVS_DIREnv/container state directory
SHELLM_WORKDIRS_DIRWorking directories base
SHELLM_BROKER_DIRDocker broker state directory
THINK_MODELModel for think cycles
THINK_TICK_INTERVALSeconds between autonomous ticks

Other important vars (not identity-scoped):

VariablePurpose
SHELLM_MODELDefault model for shellm
ANTHROPIC_API_KEYAnthropic API key for llm
OPENAI_API_KEYOpenAI API key for llm

Identity directory layout

.identities/<name>/
  info.txt              name=, cwd=, created=, think_model=, interval=
  activate              source-able activation script
  core_identity_prompt.md  (optional) custom system prompt
  .env                  (optional) identity-specific env vars
  memories/             mem entries (markdown files)
  skills/               installed skills
    .skillsrc           skill remotes config
  kernel/               kernel skills (always loaded)
    mem/SKILL.md        bootstrapped mem skill
  .trajectories/        trajectory files
    trajectory.jsonl          main consciousness stream
    blobs/              spilled large fields
  .shellm/              shellm working state
  workdir/              working directory for think cycles

How a think cycle works

  1. think step loads the think prompt template from $IDENTITY_DIR/prompts/think.md
  2. Replaces {{identity_name}} and {{goals}} in the template
  3. Appends recent traj context (last N steps via traj tail)
  4. Calls shellm with this prompt — shellm executes bash, loops until FINAL
  5. Writes the resulting thought or action to traj
  6. If it was an action, forks a child branch, executes via shellm, merges back
  7. Dispatches thought processes (TPs) — each TP gets recent thoughts and can write to traj/mem

Thinkers

Thinkers live in thinkers/. Each has a step script, prompt.md, and subscriptions.jsonl. They subscribe to trajectory events and run autonomously via thinkers start:

  • main — core thought generator, produces stream-of-consciousness thoughts and actions
  • intentions-goals-creator — notices emerging goals, stores via mem
  • intentions-goals-enforcer — redirects when the stream drifts from goals
  • learning — extracts lessons from action/observation pairs
  • mind-wandering — surfaces associative memories
  • system-architecture — meta-cognitive self-modification
  • values-beliefs-creator — crystallizes values and beliefs
  • values-beliefs-enforcer — flags misalignment between behavior and values

Tips

  • All tools are designed to be composed via pipes and env vars
  • shellm is the only script that calls the LLM directly (via llm); everything else builds prompts and calls shellm
  • The context script is the bridge between traj (step log) and llm (messages array)
  • Skills are loaded on-demand via skills show <name>; kernel skills are always in context
  • To understand any script's full interface, run it with --help or read the source in bin/

© laude-institute, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/shellm of laude-institute/headlong.

Open the folder on GitHubat commit d77aadd

Compare with similar skills

Shellm Architecture Reference next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Shellm Architecture Reference compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Shellm Architecture Reference this skilllaude-institute/headlong1.2k—~2kAutomated safety check: NotesApache-2.0
Hns Moaiadk Dev Referencemodu-ai/moai-adk1.2k—~937Automated safety check: PassApache-2.0
Mole Bug Patternstw93/Mole70k—~2kAutomated safety check: PassGPL-3.0
Neat-Freak Knowledge CloseoutKKKKhazix/khazix-skills21k—~1.9kAutomated safety check: PassMIT
CLI DeveloperJeffallan/claude-skills12k1 repos~1.2kAutomated safety check: PassMIT
JSON Processing with jqcharmbracelet/crush29k—~746Automated safety check: PassCustom licence

Similar skills

  • moai-adk-go local dev reference — version management/release process (sec 5), shell-script hook development (sec 7), build & dev commands (sec 10).

    1.2k GitHub stars~937 tokensUpdated today
    DevelopmentAuto-check passed
  • A catalog of recurring bug shapes in the Mole Mac cleaner, used to review safety-sensitive diffs for deletion safety, unbounded commands, shell traps and weak tests.

    70k GitHub stars~2k tokensUpdated today
    DevelopmentAuto-check passed
  • Neat-Freak Knowledge Closeout

    KKKKhazix/khazix-skills

    Brings project docs, agent rule files, authorized memory and leftover workspace files back in line with what the code and runtime actually do at the end of a work session.

    21k GitHub stars~1.9k tokensUpdated 8 days ago
    Agent WorkflowsAuto-check passed
  • CLI Developer

    Jeffallan/claude-skills

    Walks through designing, building and polishing a command-line tool: user workflow and command hierarchy, implementation in commander, click, typer or cobra, completions and cross-platform testing.

    12k GitHub starsUsed in 1 repo~1.2k tokens
    DevelopmentAuto-check passed
  • JSON Processing with jq

    charmbracelet/crush

    Explains the jq command built into Crush for querying, filtering and reshaping JSON, including its supported flags and where it differs from standard jq.

    29k GitHub stars~746 tokensUpdated today
    DevelopmentAuto-check passed
  • Cpp

    crazyguitar/cppcheatsheet

    Comprehensive C/C++ programming reference covering everything from C11-C23 and C++11-C++23, system programming, CUDA GPU computing, debugging tools, Rust interop, and advanced topics.

    290 GitHub stars~1.8k tokensUpdated 2 days ago
    DevelopmentAuto-check passed

More from laude-institute/headlong

All 10 skills in this repo
  • ShellLM Skill Author

    laude-institute/headlong

    Scaffolds new ShellLM skills with the right frontmatter, directory layout and agent-facing writing style, so an agent can extend its own capabilities.

    1.2k GitHub stars~1.3k tokensUpdated 2 days ago
    Auto-check passed
  • Web Research With curl

    laude-institute/headlong

    Looks things up online from the shell with curl: fetching pages, searching DuckDuckGo's HTML endpoint, stripping tags for readable text and pulling JSON APIs.

    1.2k GitHub stars~362 tokensUpdated 2 days ago
    Auto-check passed
  • Google Workspace CLI

    laude-institute/headlong

    Drives Google Drive, Gmail, Calendar, Sheets, Docs and Chat from the shell with the gws CLI, including its sign-in, flags, helper commands and safety rules.

    1.2k GitHub stars~1.2k tokensUpdated 2 days ago
    Auto-check passed
  • Obsidian

    laude-institute/headlong

    Read, write, search, and manage notes in an Obsidian vault. An agent skill from laude-institute/headlong.

    1.2k GitHub stars~880 tokensUpdated 2 days ago
    Auto-check passed
  • Slack

    laude-institute/headlong

    Talk with people on Slack — recognize slack- senders and reach them via chat reply

    1.2k GitHub stars~831 tokensUpdated 2 days ago
    Auto-check passed
  • Telegram

    laude-institute/headlong

    Send and receive messages via the Telegram Bot API using curl

    1.2k GitHub stars~623 tokensUpdated 2 days ago
    Auto-check passed

Works with

Questions about Shellm Architecture Reference

What does Shellm Architecture Reference do?

Explains how shellm's bash-based recursive LLM shell fits together - its core engine, identity system, memory, skills and trajectory log. This skill is a map of shellm, a set of composable bash scripts that turn an LLM into an autonomous agent living in a shell, stacked bottom to top from raw multi-provider LLM calls, through a recursive execute-in-shell loop, up to a step log and message assembly layer for multi-turn conversation. An agent activates one of several isolated identities by sourcing an activation script, which sets environment variables that every other tool then reads - there are no global config files.

When should I use Shellm Architecture Reference?

Shellm Architecture Reference fits situations like: understanding how shellm's identity, memory and trajectory pieces fit together; debugging unexpected agent behavior inside the shellm system; looking up which bin/ script handles a specific shellm capability.

How do I install Shellm Architecture Reference in Claude Code?

Run `npx skills add laude-institute/headlong --skill shellm -a claude-code`. Or copy the skill folder (skills/shellm in laude-institute/headlong) into .claude/skills/shellm in your project. Claude Code loads it when a task matches its description.

How do I install Shellm Architecture Reference in Codex?

Run `npx skills add laude-institute/headlong --skill shellm -a codex`. Or copy the skill folder (skills/shellm in laude-institute/headlong) into .agents/skills/shellm in your project. Codex loads it when a task matches its description.

Can I use Shellm Architecture Reference in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add laude-institute/headlong --skill shellm -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/shellm, .gemini/skills/shellm, .github/skills/shellm and .opencode/skills/shellm in your project.

What does Shellm Architecture Reference need to run?

Going by SKILL.md and its folder, Shellm Architecture Reference needs credentials named ANTHROPIC_API_KEY and OPENAI_API_KEY. Our summary lists: bash.

Does Shellm Architecture Reference access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Shellm Architecture Reference safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Shellm Architecture Reference use?

Shellm Architecture Reference is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Shellm Architecture Reference use?

About 2k tokens (SKILL.md is roughly 8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Shellm Architecture Reference?

Skills that share tags, products or a category with Shellm Architecture Reference: Hns Moaiadk Dev Reference (modu-ai/moai-adk, 1.2k stars), Mole Bug Patterns (tw93/Mole, 70k stars), Neat-Freak Knowledge Closeout (KKKKhazix/khazix-skills, 21k stars) and CLI Developer (Jeffallan/claude-skills, 12k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Shellm Architecture Reference?

laude-institute (a GitHub organization) maintains it in laude-institute/headlong, which has 1,217 GitHub stars. The repository holds 10 skills in this directory. The repository was last updated on October 7, 2026.

Source: laude-institute/headlong on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.