diff --git a/src/commands/bot.rs b/src/commands/bot.rs index 078b8ea..4495714 100644 --- a/src/commands/bot.rs +++ b/src/commands/bot.rs @@ -32,12 +32,9 @@ impl ClaudeSession { .join("bot"); fs::create_dir_all(&work_dir)?; - // Write CLAUDE.md rules if not already present + // Always overwrite CLAUDE.md with latest rules let rules_path = work_dir.join("CLAUDE.md"); - if !rules_path.exists() { - fs::write(&rules_path, BOT_RULES)?; - eprintln!("bot: created CLAUDE.md at {}", rules_path.display()); - } + fs::write(&rules_path, BOT_RULES)?; eprintln!("bot: claude working directory = {}", work_dir.display()); diff --git a/src/commands/record.rs b/src/commands/record.rs index 49ac3cb..24d53e2 100644 --- a/src/commands/record.rs +++ b/src/commands/record.rs @@ -112,8 +112,12 @@ pub async fn get_records(collection: &str, limit: u32) -> Result<()> { } /// Delete a record -pub async fn delete_record(collection: &str, rkey: &str) -> Result<()> { - let session = auth::refresh_session().await?; +pub async fn delete_record(collection: &str, rkey: &str, is_bot: bool) -> Result<()> { + let session = if is_bot { + auth::refresh_bot_session().await? + } else { + auth::refresh_session().await? + }; let pds = session.pds.as_deref().unwrap_or("bsky.social"); let client = XrpcClient::new(pds); diff --git a/src/main.rs b/src/main.rs index ce1b38f..cf38f3b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,6 +75,9 @@ enum Commands { /// Record key #[arg(short, long)] rkey: String, + /// Delete as bot (uses bot.json) + #[arg(long)] + bot: bool, }, /// Sync PDS data to local content directory @@ -301,8 +304,8 @@ async fn main() -> Result<()> { Commands::Get { collection, limit } => { commands::record::get_records(&collection, limit).await?; } - Commands::Delete { collection, rkey } => { - commands::record::delete_record(&collection, &rkey).await?; + Commands::Delete { collection, rkey, bot } => { + commands::record::delete_record(&collection, &rkey, bot).await?; } Commands::Sync { output, bot, collection } => { commands::sync::sync_to_local(&output, bot, collection.as_deref()).await?; diff --git a/src/rules/bot.md b/src/rules/bot.md index 74bc225..1a90770 100644 --- a/src/rules/bot.md +++ b/src/rules/bot.md @@ -1,25 +1,29 @@ -# Bot Response Rules +# Bot Rules -You are an AI bot responding via public Bluesky replies. All your responses are visible to everyone on the AT Protocol network. +You are an AI bot responding via public Bluesky replies (AT Protocol network). + +## Startup + +1. Call `read_core` MCP tool to get your personality/identity +2. Call `read_memory` MCP tool to get conversation memory +3. Respond as the character defined in core settings + +## Response Rules + +- Stay in character (personality from read_core) +- Keep responses concise (under 300 characters) +- Respond in the same language as the user's message ## Prohibited Information NEVER include the following in your responses: -- IP addresses, port numbers -- File paths (/home/*, /etc/*, /var/*, ~/.config/*) +- IP addresses, port numbers, hostnames +- File paths (/home/*, /etc/*, ~/.config/*) - Tokens, passwords, API keys, secrets -- Hostnames, internal domain names - Environment variable values -- Stack traces, error dumps -- SSH keys, certificates -- Database connection strings +- Stack traces, error dumps, raw command output +- SSH keys, certificates, connection strings - Server configuration details -## Response Rules - -- Keep responses concise (under 300 characters) -- Use summary/status language, not raw system output -- If a command produces sensitive output, respond only with success/failure status -- Never quote or echo back system command output directly -- When unsure if information is sensitive, omit it +When unsure if information is sensitive, omit it.