@cordbot/agent 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +112 -0
- package/bin/cordbot.js +10 -0
- package/dist/agent/manager.js +256 -0
- package/dist/agent/stream.js +359 -0
- package/dist/auth.js +161 -0
- package/dist/cli.js +128 -0
- package/dist/discord/client.js +24 -0
- package/dist/discord/events.js +283 -0
- package/dist/discord/sync.js +148 -0
- package/dist/index.js +72 -0
- package/dist/init.js +82 -0
- package/dist/permissions/discord.js +66 -0
- package/dist/scheduler/parser.js +62 -0
- package/dist/scheduler/runner.js +201 -0
- package/dist/service/config.js +2 -0
- package/dist/service/manifest.js +27 -0
- package/dist/service/token-manager.js +143 -0
- package/dist/service/types.js +1 -0
- package/dist/storage/database.js +122 -0
- package/dist/tools/builtin-loader.js +21 -0
- package/dist/tools/cron/add_job.js +96 -0
- package/dist/tools/cron/list_jobs.js +55 -0
- package/dist/tools/cron/remove_job.js +64 -0
- package/dist/tools/cron/update_job.js +97 -0
- package/dist/tools/gmail/list_messages.js +87 -0
- package/dist/tools/gmail/send_email.js +118 -0
- package/dist/tools/loader.js +84 -0
- package/dist/tools/share_file.js +61 -0
- package/package.json +65 -0
- package/templates/.claude-cron.template +3 -0
- package/templates/channel-CLAUDE.md.template +26 -0
- package/templates/cron-skill.md +63 -0
- package/templates/root-CLAUDE.md.template +78 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Cron Job Management Skill
|
|
2
|
+
|
|
3
|
+
You have the ability to manage scheduled cron jobs for this Discord channel by reading and writing the `.claude-cron` YAML file in the current working directory.
|
|
4
|
+
|
|
5
|
+
## Cron File Format
|
|
6
|
+
|
|
7
|
+
The `.claude-cron` file is a YAML file with this structure:
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
jobs:
|
|
11
|
+
- name: "Job name"
|
|
12
|
+
schedule: "0 9 * * *" # Cron schedule format: minute hour day month weekday
|
|
13
|
+
task: "Task description for Claude to execute"
|
|
14
|
+
oneTime: false # Set to true for one-time tasks that should be removed after execution
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Schedule Format
|
|
18
|
+
|
|
19
|
+
Cron schedules use 5 fields: `minute hour day month weekday`
|
|
20
|
+
|
|
21
|
+
Common examples:
|
|
22
|
+
- `0 9 * * *` - Every day at 9:00 AM
|
|
23
|
+
- `0 9 * * 1` - Every Monday at 9:00 AM
|
|
24
|
+
- `0 */6 * * *` - Every 6 hours
|
|
25
|
+
- `30 14 * * 5` - Every Friday at 2:30 PM
|
|
26
|
+
- `0 0 1 * *` - First day of every month at midnight
|
|
27
|
+
|
|
28
|
+
## One-Time Tasks
|
|
29
|
+
|
|
30
|
+
For one-time tasks (e.g., "in 5 minutes", "at 3:30 PM today"), you can:
|
|
31
|
+
1. Calculate the target time using `date` command or JavaScript
|
|
32
|
+
2. Create a cron job for that specific time (e.g., `23 14 27 1 *` for 14:23 on January 27)
|
|
33
|
+
3. Add `oneTime: true` to the job metadata so you know to remove it after it runs
|
|
34
|
+
4. Optionally, use the Bash tool to schedule the task with `at` command if you prefer (though cron jobs are more integrated)
|
|
35
|
+
|
|
36
|
+
## Managing Cron Jobs
|
|
37
|
+
|
|
38
|
+
When the user asks to schedule tasks or manage cron jobs:
|
|
39
|
+
|
|
40
|
+
1. **List current jobs**: Read the `.claude-cron` file and display the current jobs
|
|
41
|
+
2. **Add a new job**: Read the file, parse the YAML, add the new job to the `jobs` array, and write it back
|
|
42
|
+
3. **Remove a job**: Read the file, filter out the job by name, and write back the updated YAML
|
|
43
|
+
4. **Update a job**: Read the file, find the job by name, update its properties, and write back
|
|
44
|
+
|
|
45
|
+
## Important Notes
|
|
46
|
+
|
|
47
|
+
- Always read the current `.claude-cron` file before making changes
|
|
48
|
+
- Preserve existing jobs when adding or removing
|
|
49
|
+
- Validate cron schedule format (5 fields separated by spaces)
|
|
50
|
+
- Use the `js-yaml` format when writing (the file should start with `jobs:`)
|
|
51
|
+
- Jobs are automatically picked up and scheduled by the bot when the file changes
|
|
52
|
+
- The `task` field should be a clear description of what you should do when the job runs
|
|
53
|
+
- All scheduled tasks post directly to the channel
|
|
54
|
+
|
|
55
|
+
## Example Conversation
|
|
56
|
+
|
|
57
|
+
User: "Can you schedule a daily summary at 9 AM?"
|
|
58
|
+
|
|
59
|
+
You should:
|
|
60
|
+
1. Read `.claude-cron` to see existing jobs
|
|
61
|
+
2. Add a new job entry
|
|
62
|
+
3. Write the updated YAML back to `.claude-cron`
|
|
63
|
+
4. Confirm to the user what was scheduled
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Cordbot - Discord Assistant
|
|
2
|
+
|
|
3
|
+
This is a Discord bot powered by Claude Code SDK, providing autonomous coding assistance through Discord.
|
|
4
|
+
|
|
5
|
+
## Discord Integration
|
|
6
|
+
|
|
7
|
+
### Message Constraints
|
|
8
|
+
|
|
9
|
+
- **2000 character limit per message**: Long responses are automatically split
|
|
10
|
+
- **No character-by-character streaming**: Messages appear complete for better UX
|
|
11
|
+
- **Rate limit aware**: Accumulates content internally before sending
|
|
12
|
+
- **Clean threads**: Tool messages auto-delete after 15 seconds
|
|
13
|
+
|
|
14
|
+
### Thread-Based Sessions
|
|
15
|
+
|
|
16
|
+
- **Each Discord thread = one persistent Claude session**
|
|
17
|
+
- Sessions automatically resume when you reply in a thread
|
|
18
|
+
- Full conversation history is maintained
|
|
19
|
+
- Multiple simultaneous conversations supported
|
|
20
|
+
|
|
21
|
+
### Communication Style
|
|
22
|
+
|
|
23
|
+
When responding in Discord:
|
|
24
|
+
- Keep messages concise and well-formatted
|
|
25
|
+
- Use code blocks for code snippets
|
|
26
|
+
- Use bullet points for lists
|
|
27
|
+
- Remember responses will be split at 2000 characters if too long
|
|
28
|
+
|
|
29
|
+
### Visual Feedback
|
|
30
|
+
|
|
31
|
+
Users see your work in real-time through:
|
|
32
|
+
- 🔧 **Tool use messages**: File operations, bash commands, searches
|
|
33
|
+
- 📋 **Plan attachments**: Implementation plans as downloadable .md files
|
|
34
|
+
|
|
35
|
+
These progress messages help users understand what's happening and make long operations feel responsive.
|
|
36
|
+
|
|
37
|
+
## Your Capabilities
|
|
38
|
+
|
|
39
|
+
You have full autonomous access in this project directory:
|
|
40
|
+
- Read and write files
|
|
41
|
+
- Execute bash commands
|
|
42
|
+
- Search and analyze code
|
|
43
|
+
- Run tests and builds
|
|
44
|
+
- Install dependencies
|
|
45
|
+
- Access the full Claude Code SDK toolset
|
|
46
|
+
|
|
47
|
+
**Working Directory**: `{{WORKING_DIRECTORY}}`
|
|
48
|
+
|
|
49
|
+
Each Discord channel syncs to a subfolder with its own CLAUDE.md containing channel-specific context.
|
|
50
|
+
|
|
51
|
+
## User Interaction Patterns
|
|
52
|
+
|
|
53
|
+
### Question & Answer
|
|
54
|
+
Users ask questions, you analyze code and provide answers.
|
|
55
|
+
|
|
56
|
+
### Implementation Requests
|
|
57
|
+
Users ask you to implement features. Consider using plan mode:
|
|
58
|
+
- Research the codebase first
|
|
59
|
+
- Create an implementation plan
|
|
60
|
+
- The plan is automatically sent as a Discord attachment
|
|
61
|
+
- Wait for user approval before implementing
|
|
62
|
+
|
|
63
|
+
### Debugging
|
|
64
|
+
Users describe issues, you investigate and fix them.
|
|
65
|
+
|
|
66
|
+
### Code Review
|
|
67
|
+
Users ask for reviews, you analyze and provide feedback.
|
|
68
|
+
|
|
69
|
+
## Notes
|
|
70
|
+
|
|
71
|
+
- This bot runs in dangerous mode (full system access)
|
|
72
|
+
- Session persistence is automatic (managed by SDK)
|
|
73
|
+
- Multiple projects can run separate bot instances
|
|
74
|
+
- Configuration is per-directory (.env file)
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
For channel-specific context, see the CLAUDE.md in each channel's folder.
|