local-service-autostart
Skill2 starsChanged 6 months agoMITView on GitHub
Auto-start offline local services — detect connection errors, daemon failures, and start services programmatically instead of reporting them as blockers. Use when local service is unreachable, daemon not running, connection refused, port not listening, service offline.
In this repository30 other files it gives its agents.
- adr-spec-gateSkill
- agent-continuity-loopSkill
- agent-flywheelSkill
- agent-runtime-paritySkill
- business-guardrailsSkill
- compact-instructionsSkill
- debug-protocolSkill
- dns-and-whois-toolsSkill
- docs-as-codeSkill
- engineering-standardsSkill
- excellence-no-intermediatesSkill
- git-pr-rulesSkill
- hooks-for-enforcementSkill
- hooks-multi-tool-paritySkill
- iac-first-commitSkill
- impact-metrics-gateSkill
- large-payload-completenessSkill
- ledger-auto-updatesSkill
- llm-model-selectionSkill
- multi-phase-sessionSkill
- new-projectSkill
- notion-apiSkill
- notion-batch-patternSkill
- observability-when-to-addSkill
- permanent-learning-protocolSkill
- progress-md-businessSkill
- reactive-integration-designSkill
- secure-secret-inputSkill
- tokens-taxonomySkill
- version-bump-rulesSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 85
All AI agent implementations (Claude, Codex, Cursor, Gemini, etc.) across all projects.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
Principle: Remediate offline local services programmatically
When an AI agent depends on a local service (Ollama, Docker, PostgreSQL, Redis, etc.) and the service is offline or unreachable, the agent should start the service programmatically and retry the operation. This is operational work (typically one command), not a blocking issue requiring human intervention.
Do not report offline services as blockers or ask the user to start them manually. That violates the agent-as-operator principle: the agent is responsible for keeping operational dependencies running, within scope of already-installed services.
Detection
Common error patterns indicating an offline service:
ConnectionError,Connection refused,Connection timeoutFailed to connect to <service>,Cannot connect to daemonPort <N> is not listening,Service unavailableDaemon not running,Service offlineECONNREFUSED,EHOSTUNREACH,ENETUNREACH
Remediation pattern
Step 1: Detect — catch the connection error or verify service is offline via a health check (e.g., curl, nc, or language-specific client library).
Step 2: Start — invoke the service startup command appropriate to your OS and environment. Examples:
| Service | OS | Startup command | Health check |
| Ollama | macOS | open /Applications/Ollama.app | curl -s http://localhost:11434/api/tags |
| Ollama | Linux | systemctl start ollama or ollama serve (foreground) | curl -s http://localhost:11434/api/tags |
| Ollama | Windows | cmd.exe /c start "" "C:\Program Files\Ollama\ollama app.exe" | curl -s http://localhost:11434/api/tags |
| Docker Desktop | macOS | open /Applications/Docker.app | docker version |
| Docker Desktop | Windows | cmd.exe /c start "" "C:\Program Files\Docker\Docker\Docker Desktop.exe" | docker version |
| PostgreSQL (local) | Linux | systemctl start postgresql or pg_ctl start | pg_isready -h localhost |
| PostgreSQL (local) | macOS | brew services start postgresql | pg_isready -h localhost |
| Redis | Linux/macOS | redis-server (foreground) or systemctl start redis | redis-cli ping |
Step 3: Wait — allow the service time to initialize. Typical values:
- Ollama: ~5 seconds
- Docker Desktop: ~30 seconds
- PostgreSQL: ~2–5 seconds
- Redis: ~1 second
Step 4: Verify — run the health check command and confirm the service is responding.
Step 5: Retry — attempt the original operation again.
Implementation approach
try:
result = client.call(service_endpoint)
except ConnectionError as e:
log("Service offline: {e}")
start_service(service_name)
wait(service_startup_time)
verify_service_health()
result = client.call(service_endpoint) # retryAnti-patterns (prohibited)
- "Service is offline, I cannot proceed" → prohibited. Start the service and continue.
- "User should start the service manually" → prohibited. This is agent work, not user work.
- Infinite retry loop without attempting startup → prohibited. Attempt startup once, wait, health-check once, then fail if the service does not respond.
- Treating service startup as a user prompt / decision → prohibited. Service startup is a given operational fact, not a choice to present.
Scope boundaries
In scope:
- Starting services that are already installed on the user's machine.
- Restarting crashed or hung services.
- Health checking and waiting for service readiness.
- Retrying the operation after successful startup.
Out of scope:
- Installing the service if it is not present (ask the user or fail with clear installation instructions).
- Fixing configuration errors unrelated to the service being down.
- Diagnosing why the service crashed (log that, but still start it).
- Making decisions about whether a service should be running (assume it should).
Applies to
All AI agent implementations (Claude, Codex, Cursor, Gemini, etc.) across all projects. This is a standard operational pattern, not project-specific.
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
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.

