This commit is contained in:
2026-03-01 16:46:09 +09:00
parent 09780fab1d
commit 9b0816138c
4 changed files with 32 additions and 24 deletions

View File

@@ -32,12 +32,9 @@ impl ClaudeSession {
.join("bot"); .join("bot");
fs::create_dir_all(&work_dir)?; 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"); let rules_path = work_dir.join("CLAUDE.md");
if !rules_path.exists() {
fs::write(&rules_path, BOT_RULES)?; fs::write(&rules_path, BOT_RULES)?;
eprintln!("bot: created CLAUDE.md at {}", rules_path.display());
}
eprintln!("bot: claude working directory = {}", work_dir.display()); eprintln!("bot: claude working directory = {}", work_dir.display());

View File

@@ -112,8 +112,12 @@ pub async fn get_records(collection: &str, limit: u32) -> Result<()> {
} }
/// Delete a record /// Delete a record
pub async fn delete_record(collection: &str, rkey: &str) -> Result<()> { pub async fn delete_record(collection: &str, rkey: &str, is_bot: bool) -> Result<()> {
let session = auth::refresh_session().await?; 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 pds = session.pds.as_deref().unwrap_or("bsky.social");
let client = XrpcClient::new(pds); let client = XrpcClient::new(pds);

View File

@@ -75,6 +75,9 @@ enum Commands {
/// Record key /// Record key
#[arg(short, long)] #[arg(short, long)]
rkey: String, rkey: String,
/// Delete as bot (uses bot.json)
#[arg(long)]
bot: bool,
}, },
/// Sync PDS data to local content directory /// Sync PDS data to local content directory
@@ -301,8 +304,8 @@ async fn main() -> Result<()> {
Commands::Get { collection, limit } => { Commands::Get { collection, limit } => {
commands::record::get_records(&collection, limit).await?; commands::record::get_records(&collection, limit).await?;
} }
Commands::Delete { collection, rkey } => { Commands::Delete { collection, rkey, bot } => {
commands::record::delete_record(&collection, &rkey).await?; commands::record::delete_record(&collection, &rkey, bot).await?;
} }
Commands::Sync { output, bot, collection } => { Commands::Sync { output, bot, collection } => {
commands::sync::sync_to_local(&output, bot, collection.as_deref()).await?; commands::sync::sync_to_local(&output, bot, collection.as_deref()).await?;

View File

@@ -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 ## Prohibited Information
NEVER include the following in your responses: NEVER include the following in your responses:
- IP addresses, port numbers - IP addresses, port numbers, hostnames
- File paths (/home/*, /etc/*, /var/*, ~/.config/*) - File paths (/home/*, /etc/*, ~/.config/*)
- Tokens, passwords, API keys, secrets - Tokens, passwords, API keys, secrets
- Hostnames, internal domain names
- Environment variable values - Environment variable values
- Stack traces, error dumps - Stack traces, error dumps, raw command output
- SSH keys, certificates - SSH keys, certificates, connection strings
- Database connection strings
- Server configuration details - Server configuration details
## Response Rules When unsure if information is sensitive, omit it.
- 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