agentleFS
roerohanroerohan/skills/timesharing/SKILL.md

timesharing

Skill29 starsChanged 7 months agoMITView on GitHub

Multiplexes one agent's attention across independent long-running external processes while preserving one reasoning context. Use for concurrent tests, builds, servers, watchers, REPLs, benchmarks, downloads, and other latency-bearing shell work; never use it to spawn or substitute subagents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 13 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Treat yourself as a cooperative scheduler:

    line 17
  2. Distinctive:

    Start it asynchronously and record its purpose, provenance, dependency, and revisit point.

    line 20
  3. Distinctive:

    Use a small number of jobs, usually 2-4.

    line 25
  4. Very specific:

    Run trivial or immediately blocking commands normally: pwd, git status, small reads, quick searches, and commands whose answer determines …

    line 38
  5. Distinctive:

    Before launch, form a tiny dependency graph.

    line 42
  6. Distinctive:

    Before consuming a result, compare its launch provenance with current files/configuration.

    line 92
  7. Distinctive:

    Before answering the user:

    line 102
  8. Distinctive:

    Never claim success without a verified zero exit status.

    line 105
  9. Distinctive:

    Check that results still match the current code/input state.

    line 106
  10. Distinctive:

    Stop and clean disposable jobs you own.

    line 108
  11. Distinctive:

    Fake concurrency: do useful work after launch.

    line 116
  12. Distinctive:

    Context flooding: read a relevant tail, not 50,000 repeated log lines.

    line 117
  13. Distinctive:

    Excessive concurrency: prefer 2-4 purposeful jobs, not 14 vague experiments.

    line 118
  14. Distinctive:

    Speculative overlap: do not run work whose inputs are still being rewritten.

    line 120

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Timesharing

Timesharing lets one agent preserve one coherent reasoning context while opportunistically multiplexing its attention across independent external work.

The AI's reasoning stays serial. Only ordinary OS processes run concurrently. Never spawn a subagent, delegate interpretation, or create another AI context for this workflow.

Central Rule

Never block on an independent long-running process when useful independent work exists.

Treat yourself as a cooperative scheduler:

  1. Identify a command whose result is not immediately required.
  2. Start it asynchronously and record its purpose, provenance, dependency, and revisit point.
  3. Continue concrete independent work immediately.
  4. Revisit at a natural boundary, not through busy polling.
  5. Interpret the result in the same context that launched it.

Use a small number of jobs, usually 2-4. The goal is to hide external latency without losing cognitive coherence, not to maximize concurrency.

Decide

Timeshare when judgment says all of these are true:

  • The command may take meaningful time or must remain alive.
  • Its result is not required for the next reasoning step.
  • Useful independent work exists, or later interaction/incremental output matters.
  • Its inputs are stable enough that the run will remain useful.

Typical jobs include test suites, builds, installs, Docker builds, servers, watchers, long scripts, migrations, data/model processing, downloads, benchmarks, integration tests, REPLs, and debuggers.

Run trivial or immediately blocking commands normally: pwd, git status, small reads, quick searches, and commands whose answer determines the very next step. Use judgment, not a hard timing threshold.

Schedule

Before launch, form a tiny dependency graph. Only overlap genuinely independent work. Do not start a run whose inputs are likely to be invalidated immediately.

Maintain a lightweight in-context ledger:

JOB       PURPOSE             LOCATION                 STATE    DEPENDS/REVISIT
ts-tests  validate parser     tmux:ts-repo-tests-...   running  after serializer edit
ts-api    integration target  tmux:ts-repo-api-...     persistent before requests

Know for each job: what and why, location, state, expected result, dependents, revisit point, and code/input provenance. The helper persists operational metadata; the purpose and dependency graph remain in this agent's unified mental model.

Natural scheduling points include after an edit, before a dependent decision, after another job completes, when no independent work remains, before final response, or when input may be needed. Do not repeatedly check a job without useful work between checks. If nothing useful remains, bounded waiting or inspection is honest and appropriate.

Use The Interface

The bundled script prefers isolated tmux sessions and falls back to background processes when tmux is unavailable. Run it by absolute path when necessary:

timesharing/scripts/timeshare.sh start tests \
  --purpose 'validate parser fix' --dependency 'review after serializer edit' \
  --provenance 'parser change A' -- npm test
timesharing/scripts/timeshare.sh start api --persistent \
  --purpose 'serve integration target' -- npm run dev
timesharing/scripts/timeshare.sh list
timesharing/scripts/timeshare.sh status tests
timesharing/scripts/timeshare.sh inspect tests --lines 80
timesharing/scripts/timeshare.sh send repl --literal 'value.inspect' --enter
timesharing/scripts/timeshare.sh interrupt api
timesharing/scripts/timeshare.sh stop api
timesharing/scripts/timeshare.sh cleanup

Names become lowercase ts-* job IDs. The tmux session also includes a repository name and workspace hash, preventing cross-repository collisions. Existing live jobs are never silently replaced. Resolve and inspect exact registered IDs before sending input, interrupting, or stopping anything.

For detailed operations, states, fallback behavior, and failures, read references/operations.md. For scheduling examples, read references/examples.md. Load the lower-level tmux skill only when pane layout or tmux-specific mechanics beyond this interface are needed.

Interpret State And Output

The lifecycle is:

planned -> running -> completed | failed | waiting | persistent
        -> consumed -> cleaned up

The helper detects running, completed, failed, persistent, and unexpectedly terminated. For interactive jobs, infer waiting versus computing from the recent tail and prompt. Infer a stall only from elapsed time, unchanged output, expected behavior, and process state; do not guess from silence alone.

Inspect recent output first. Increase --lines only when the error needs earlier context. Never flood this context with whole logs by default. Treat a missing completion marker as unknown/unexpected termination, not success.

Before consuming a result, compare its launch provenance with current files/configuration. A run against state A does not validate later state B. Rerun relevant validation after material edits.

Interactive And Persistent Jobs

Mark servers/watchers with --persistent; continued execution is expected, not failure. Mark REPLs/debuggers with --interactive; tmux is required. Inspect the exact job before send, and send the least powerful input needed. Never send destructive keys to an uncertain target.

The shell fallback supports finite and persistent non-interactive commands, but not interactive input or durable terminal attachment. Report that limitation when fallback is used.

Finish

Before answering the user:

  • Inspect every important outstanding finite job.
  • Never claim success without a verified zero exit status.
  • Check that results still match the current code/input state.
  • State which requested services intentionally remain persistent.
  • Stop and clean disposable jobs you own; never kill uncertain or unrelated processes.
  • Preserve services the user explicitly asked to leave running.

Communicate only meaningful transitions: "Tests are running while I inspect the serializer" or "The build passed; integration tests are still running." Do not narrate every tmux command or status check.

Anti-Patterns

  • Subagent substitution: same agent launches a process; never spawn another AI to run or interpret it.
  • Fake concurrency: do useful work after launch; do not launch and immediately poll in a loop.
  • Context flooding: read a relevant tail, not 50,000 repeated log lines.
  • Excessive concurrency: prefer 2-4 purposeful jobs, not 14 vague experiments.
  • Stale validation: record what state ran and never apply an old result to newer changes.
  • Speculative overlap: do not run work whose inputs are still being rewritten.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.