pisan-labs

Fork Count — Development skill for Claude Code

Development community

Paste a C fork/wait/printf/pipe snippet and see its process tree, every output the scheduler could produce with stdio buffering modelled, and why an output you type is impossible.

How to install Fork Count

This entry records only its repository, not the path inside it, so there is no exact command to give. Open pisan-labs/fork-count and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Fork Count does

Paste a C fork/wait/printf/pipe snippet and see its process tree, every output the scheduler could produce with stdio buffering modelled, and why an output you type is impossible. Also generates exam questions checked against every schedule. Built with Claude Code.

Alternatives in Development

  • Octo Doctor — Environment diagnostics — check providers, auth, config, hooks, scheduler, and more 2.8k ★
  • MCP Proxy — A bridge between Streamable HTTP and stdio MCP transports 2.4k ★
  • Obsidian MCP Server — Read, write, search, and surgically edit Obsidian vault notes, tags, and frontmatter via MCP 686 ★

README

Fork Count

"How many times is hello printed?" is on nearly every operating systems exam, and most students guess. Paste a short fork/wait/exit/printf/pipe snippet and Fork Count runs every process it creates, draws the process tree (with an arrow for each pipe), and enumerates every output the scheduler could produce, stdio buffers copied at fork included. Data sent through pipes, `dup2` redirection, shell-style pipelines and the deadlocks you get from a forgotten `close` are modelled too. Type an output and it says whether some schedule prints it; if none does, it names the happens-before edge that rules it out. A generator turns templates into new exam questions whose answers are checked against every schedule.

Live: [fork-count.hintwise.org](https://fork-count.hintwise.org)

![Loading the loop-counter example shows 4 processes and 3 possible outputs, then checking an output that starts with 1 reports it impossible and names the program-order and fork edges that rule it out](demo.gif)

Built from idea 2026-10-09 n2 in [`pisanuw/daily-project-ideas`](https://github.com/pisanuw/daily-project-ideas).

![The buffered-output example: program, summary, process tree and one child-first schedule](desktop.png)

What it does

  1. Interpreter. A hand-written lexer and recursive-descent parser for a C subset: one main(), int/pid_t/char variables, one-dimensional int and char arrays (int fd[2], char buf[64], char msg[] = "hi", int a[] = {1, 2}), char * strings and string arrays (an argv for execvp), sizeof, if/else, for, while, do, break, continue, return, and C's operators other than pointer arithmetic. Calls: fork, wait, waitpid, exit, _exit, printf, fprintf(stdout|stderr), sprintf/snprintf, puts, putchar, perror, fflush, setbuf/setvbuf, getpid, getppid, sleep (ignored), WEXITSTATUS, strlen, strcpy, strcat, strcmp, atoi, the file-descriptor call