Skip to content

Commit 5dfe20a

Browse files
committed
update README and docs
1 parent b9ddd42 commit 5dfe20a

File tree

13 files changed

+4265
-63
lines changed

13 files changed

+4265
-63
lines changed

README.md

Lines changed: 166 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,47 @@
1313

1414
Have Claude Code Pro but not using it at night? Transform it into an AgentOS that handles your ideas and tasks while you sleep. This is a 24/7 AI assistant daemon powered by Claude Code CLI and Python Agent SDK that processes both random thoughts and serious tasks via Slack with isolated workspaces.
1515

16+
## 📰 News
17+
18+
- **[2025-10-26]** 🎉 Initial release v0.1.0 - Full AgentOS with multi-agent workflow support
19+
- **[2025-10-25]** 🚀 Added task auto-generation with configurable strategies
20+
- **[2025-10-24]** 🔧 Integrated Git management with automatic PR creation
21+
- **[2025-10-23]** 📊 Implemented isolated workspaces for parallel task execution
22+
- **[2025-10-22]** 💡 Added Claude Code Python Agent SDK integration
23+
24+
## 🎬 Demo
25+
26+
<div align="center">
27+
<img src="assets/cli.png" alt="Sleepless Agent CLI Demo" width="800">
28+
<p><em>Sleepless Agent CLI in action - managing tasks, checking status, and generating reports</em></p>
29+
</div>
30+
31+
### Quick Example
32+
33+
```bash
34+
# Start the daemon
35+
$ sle daemon
36+
2025-10-26 03:30:12 | INFO | Sleepless Agent starting...
37+
2025-10-26 03:30:12 | INFO | Slack bot connected
38+
39+
# Submit a task via Slack
40+
/think Implement OAuth2 authentication -p backend
41+
42+
# Check status
43+
$ sle check
44+
╭─────────────────── System Status ───────────────────╮
45+
│ 🟢 Daemon: Running │
46+
│ 📊 Queue: 3 pending, 1 in_progress │
47+
│ 💻 Usage: 45% (Day threshold: 95%) │
48+
│ 🔄 Last task: "Implement OAuth2..." (in progress) │
49+
╰─────────────────────────────────────────────────────╯
50+
51+
# View results
52+
$ sle report 42
53+
Task #42: ✅ Completed
54+
Branch: feature/backend-42
55+
PR: https://github.com/user/repo/pull/123
56+
```
1657

1758
## ✨ Features
1859

@@ -245,6 +286,69 @@ The agent automatically monitors Claude Code usage and intelligently manages tas
245286
- 📋 Pending tasks wait in queue
246287
- ⏱️ Automatic resume when usage resets
247288

289+
### Git Management
290+
291+
The agent integrates deeply with Git for automatic version control and collaboration:
292+
293+
**Remote Repository Configuration (`config.yaml`):**
294+
- `git.use_remote_repo`: Enable/disable remote repository integration
295+
- `git.remote_repo_url`: Your remote repository URL (e.g., `[email protected]:username/repo.git`)
296+
- `git.auto_create_repo`: Automatically create repository if it doesn't exist
297+
298+
**Git Workflow:**
299+
- **Random Thoughts**: Auto-commits to `thought-ideas` branch
300+
- **Serious Tasks (-p flag)**: Creates feature branches (`feature/<project>-<task_id>`) and opens PRs
301+
- **Automatic Commits**: Each task completion triggers a commit with descriptive messages
302+
- **PR Creation**: Serious tasks automatically create pull requests for review
303+
304+
**Important:** Update `git.remote_repo_url` in `config.yaml` before running the agent!
305+
306+
### Multi-Agent Workflow
307+
308+
The agent employs a sophisticated multi-agent architecture for complex task processing:
309+
310+
**Agent Types (`config.yaml`):**
311+
- **Planner Agent**: Analyzes tasks and creates execution plans (max 3 turns by default)
312+
- **Worker Agent**: Executes the planned tasks (max 3 turns by default)
313+
- **Evaluator Agent**: Reviews and validates completed work (max 3 turns by default)
314+
315+
**Configuration:**
316+
```yaml
317+
multi_agent_workflow:
318+
planner:
319+
enabled: true
320+
max_turns: 3
321+
worker:
322+
enabled: true
323+
max_turns: 3
324+
evaluator:
325+
enabled: true
326+
max_turns: 3
327+
```
328+
329+
Each agent can be independently enabled/disabled and configured with different turn limits to control execution depth.
330+
331+
### Task Auto-Generation
332+
333+
The agent can automatically generate tasks to keep itself productive during idle time:
334+
335+
**Generation Strategies (`config.yaml`):**
336+
- **refine_focused (45% weight)**: Focuses on completing or improving existing work
337+
- **balanced (35% weight)**: Mix of refinements and new tasks based on workspace state
338+
- **new_friendly (20% weight)**: Prioritizes creating innovative new projects
339+
340+
**Task Types:**
341+
- **[NEW]**: Creates a new task in an isolated workspace (`workspace/tasks/<task_id>/`)
342+
- **[REFINE:#<id>]**: Improves specific existing task (reuses task workspace)
343+
- **[REFINE]**: General refinement of workspace projects
344+
345+
**Workspace Constraints:**
346+
- Each task executes in its own isolated directory
347+
- Tasks only access their workspace and `workspace/shared/`
348+
- System directories (`workspace/data/`) are protected
349+
- REFINE tasks reuse existing workspaces for continuity
350+
351+
248352
## 🔧 Environment Variables
249353

250354
```bash
@@ -253,6 +357,8 @@ SLACK_BOT_TOKEN=xoxb-...
253357
SLACK_APP_TOKEN=xapp-...
254358
```
255359

360+
**Note:** Most configuration is done via `config.yaml`. Environment variables are primarily for secrets and deployment-specific settings.
361+
256362
## 📝 Task Types
257363

258364
The agent intelligently processes different task types:
@@ -265,53 +371,12 @@ The agent intelligently processes different task types:
265371
266372
2. **Serious Tasks** - Creates feature branch and PR, requires review (use `-p` flag)
267373
```
268-
/think Add authentication to user service -p backend
269-
/think Refactor payment processing module -p payments
374+
/think -p backend Add authentication to user service
375+
/think -p payments Refactor payment processing module
270376
```
271377
272-
## 🛠️ Development
273-
274-
### Add New Task Type
275-
276-
Edit task prompt configuration as needed in `daemon.py` or implement custom executors.
277-
278-
### Database Schema
279-
280-
Tasks are stored with:
281-
- `id`: Auto-incremented task ID
282-
- `description`: Task text
283-
- `priority`: "random" or "serious"
284-
- `status`: "pending", "in_progress", "completed", "failed"
285-
- `created_at`, `started_at`, `completed_at`: Timestamps
286-
- `result_id`: Link to Result record
287-
288-
### Testing
289-
290-
```bash
291-
# Run tests
292-
pytest
293-
294-
# Run with debug logging
295-
SLEEPLESS_LOG_LEVEL=DEBUG python -m sleepless_agent.daemon
296-
```
297-
298378
## 📊 Monitoring
299379
300-
### Real-time Logs
301-
```bash
302-
tail -f workspace/data/agent.log
303-
```
304-
305-
### Database Queries
306-
```bash
307-
sqlite3 workspace/data/tasks.db "SELECT * FROM tasks WHERE status='completed' LIMIT 5;"
308-
```
309-
310-
### Performance History
311-
```bash
312-
tail -100 workspace/data/metrics.jsonl | jq .
313-
```
314-
315380
### Slack Commands
316381
```
317382
/check # System status and performance stats
@@ -355,39 +420,77 @@ launchctl list | grep sleepless
355420
/think Performance analysis of payment module -p payments
356421
```
357422

358-
## 🔍 Troubleshooting
359-
360-
| Issue | Solution |
361-
|-------|----------|
362-
| Bot not responding | Check `.env` tokens, verify Socket Mode enabled, check logs: `tail -f workspace/data/agent.log` |
363-
| Tasks not executing | Verify Claude Code CLI installed: `npm list -g @anthropic-ai/claude-code`, check workspace permissions |
364-
| Tasks paused (threshold reached) | Usage has reached time-based threshold (20% daytime / 80% nighttime). Wait for window reset (check logs for reset time), or adjust thresholds in `config.yaml` (`claude_code.threshold_day` / `claude_code.threshold_night`). Run `sle check` to see current usage. |
365-
| Git commits fail | Install `gh` CLI and authenticate: `gh auth login` |
366-
| Out of credits | Wait for 5-hour window refresh. Review scheduler logs: `tail -f workspace/data/agent.log | grep credit` |
367-
| Database locked | Close other connections, try: `rm workspace/data/tasks.db && python -m sleepless_agent.daemon` |
368-
369423
## ⚡ Performance Tips
370424

371425
1. **Use thoughts to fill idle time** - Maximizes usage
372426
2. **Batch serious tasks** - Reduces context switching
373-
3. **Monitor credits** - Watch scheduler logs for window resets
427+
3. **Monitor usage** - Watch scheduler logs for usage patterns
374428
4. **Review git history** - Check `thought-ideas` branch regularly
375429
5. **Check metrics** - Run `sle check` to track performance
376430

377-
## 🔒 Security Notes
378-
379-
- Secrets are validated before git commits
380-
- Python syntax checked before commits
381-
- Directory traversal prevented in file operations
382-
- .env file never committed to git
383-
- Workspace changes validated before applying
384-
385431
## 📦 Releases
386432

387433
- Latest stable: **0.1.0** – published on [PyPI](https://pypi.org/project/sleepless-agent/0.1.0/)
388434
- Install or upgrade with `pip install -U sleepless-agent`
389435
- Release notes tracked via GitHub Releases (tag `v0.1.0` onward)
390436

437+
## 📚 Documentation
438+
439+
For more detailed information and guides:
440+
441+
- **[Full Documentation](https://context-machine-lab.github.io/sleepless-agent/)** - Complete documentation site
442+
- **[DeepWiki](https://deepwiki.com/context-machine-lab/sleepless-agent)** - Interactive knowledge base
443+
- **[Installation Guide](docs/installation.md)** - Detailed setup instructions
444+
- **[Quick Start](docs/quickstart.md)** - Get up and running quickly
445+
- **[FAQ](docs/faq.md)** - Frequently asked questions
446+
- **[Troubleshooting](docs/troubleshooting.md)** - Common issues and solutions
447+
448+
## 🗺️ Roadmap
449+
450+
- [ ] **Advanced Scheduling** - Priority queue with time-based and dependency scheduling
451+
- [ ] **Daily Report** - Daily report of the agent's work
452+
453+
## 🙏 Acknowledgements
454+
455+
We are deeply grateful to the open-source community and the projects that make Sleepless Agent possible:
456+
457+
- **[Claude Code CLI](https://github.com/anthropics/claude-code)** - For providing the powerful foundation for AI-assisted development and the Python Agent SDK that enables seamless integration
458+
- **[Slack Bolt](https://github.com/slackapi/bolt-python)** - For reliable real-time messaging and command handling that powers our Slack integration
459+
- **[SQLAlchemy](https://www.sqlalchemy.org/)** - For robust data persistence and elegant ORM that manages our task queue
460+
- **[Rich](https://github.com/Textualize/rich)** - For beautiful terminal rendering that makes logs and outputs visually appealing
461+
- **[GitPython](https://github.com/gitpython-developers/GitPython)** - For comprehensive Git operations that enable our automated version control workflows
462+
463+
## 🤝 Contributing
464+
465+
We welcome contributions! Sleepless Agent is designed to be a community resource for 24/7 AI development automation.
466+
467+
Please see our [Contributing Guidelines](CONTRIBUTING.md) for:
468+
- Development setup and environment configuration
469+
- Code style and testing requirements
470+
- How to submit pull requests
471+
- Community guidelines and code of conduct
472+
473+
Feel free to:
474+
- 🐛 [Report bugs](https://github.com/context-machine-lab/sleepless-agent/issues/new?labels=bug)
475+
- 💡 [Suggest features](https://github.com/context-machine-lab/sleepless-agent/issues/new?labels=enhancement)
476+
- 💬 [Ask questions](https://github.com/context-machine-lab/sleepless-agent/discussions)
477+
- 🔧 [Submit pull requests](https://github.com/context-machine-lab/sleepless-agent/pulls)
478+
479+
## 📖 Citation
480+
481+
If you use Sleepless Agent in your research or projects, please cite:
482+
483+
```bibtex
484+
@software{sleepless_agent_2025,
485+
title = {Sleepless Agent: A 24/7 AgentOS for Continuous Development},
486+
author = {Context Machine Lab},
487+
year = {2025},
488+
publisher = {GitHub},
489+
journal = {GitHub repository},
490+
url = {https://github.com/context-machine-lab/sleepless-agent}
491+
}
492+
```
493+
391494
## 📄 License
392495

393496
Released under the [MIT License](LICENSE)

assets/cli.png

329 KB
Loading

assets/wechat.jpg

153 KB
Loading

0 commit comments

Comments
 (0)