JupyterManager/docs/AGENT_PROMPT.md

44 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

# Agent Prompt for Jupyter Lifecycle Alignment
Use this prompt when instructing a coding agent (Claude, Codex, etc.) to add or fix Jupyter lifecycle management in a client project.
---
## The Prompt
```
This project needs Jupyter lifecycle management aligned with the JupyterManager
cross-project specification.
Reference implementation: https://github.com/saymrwulf/JupyterManager
Spec: docs/LIFECYCLE_SPEC.md in that repo.
Key requirements:
1. scripts/app.sh with: bootstrap, start, stop, restart, status, logs
2. Isolated Jupyter dirs (JUPYTER_CONFIG_DIR, DATA_DIR, RUNTIME_DIR, IPYTHONDIR)
all under the project root — set as env vars before any jupyter command
3. Kernel installed with --sys-prefix (not --user)
4. Auto port allocation (scan 8888-8899 for free port)
5. PID file at .logs/jupyter.pid
6. Background mode with nohup, foreground mode with exec
7. Graceful stop (SIGTERM → wait → SIGKILL fallback)
8. Orphan detection in status command
9. Stale runtime JSON cleanup on start/status
10. All isolation dirs in .gitignore
The cross-project manager (jupyter-hub) expects:
- PID files at .logs/jupyter.pid or .run/jupyter.pid
- Runtime JSON at .jupyter_runtime/jpserver-*.json
- scripts/app.sh stop to be callable from any working directory
Do NOT:
- Use --user for kernel installation
- Hardcode port 8888
- Skip the startup wait loop
- Leave out foreground mode
- Forget .gitignore entries for isolation dirs
A reference app.sh implementation exists at:
https://github.com/saymrwulf/autoresearch-quantum/blob/master/scripts/app.sh
```