🧠 Intrusive Thoughts
The complete consciousness framework for AI agents
Open-source autonomous behavior system — gives AI agents spontaneous, mood-driven activities, multi-store memory, trust learning, and self-evolution.
GitHub: https://github.com/kittleik/intrusive-thoughts
Quick Start
Run the interactive setup wizard:
CODEBLOCK0
Or through the main script:
CODEBLOCK1
The wizard walks you through personality-driven onboarding — identity, mood palette, thought pool, schedule, autonomy level, hardware awareness, and memory preferences. Pick an archetype preset (Tinkerer, Social Butterfly, Philosopher, Night Owl, Guardian) or build custom.
What This Does
Core Systems
- - 8 Moods — Hyperfocus🔥, Curious🔍, Social💬, Cozy☕, Chaotic⚡, Philosophical🌌, Restless🦞, Determined🎯
- Morning Mood Ritual — Checks weather + news → picks mood → generates dynamic schedule
- Night Workshop — Deep work sessions while your human sleeps (configurable hours)
- Daytime Pop-ins — Random mood-influenced impulses throughout the day
- Interactive Setup Wizard — Personality-driven onboarding with archetype presets
Advanced Systems (v1.0)
- - 🧠 Multi-Store Memory — Episodic, semantic, procedural memory with Ebbinghaus decay
- 🚀 Proactive Protocol — Write-Ahead Log (WAL) + Working Buffer for context management
- 🔒 Trust & Escalation — Learns when to ask vs act autonomously, grows trust over time
- 🧬 Self-Evolution — Auto-adjusts behavior based on outcome patterns
- 🚦 Health Monitor — Traffic light status, heartbeat tracking, incident logging
- 📈 Web Dashboard — Dark-themed UI on port 3117
Cron Jobs
The system needs OpenClaw cron jobs. Set these up after running the wizard:
Morning Mood Ritual (daily)
Schedule: 0 7 * * * (or your configured morning time)
CODEBLOCK2
Night Workshop (overnight)
Schedule: 17 3,4,5,6,7 * * * (or your configured night hours)
CODEBLOCK3
Note on "prompts": The thoughts.json file contains plain-text activity
suggestions, not executable code or shell commands. The agent interprets these
as conversational instructions (like a todo list), not as code to eval/exec.
All thought prompts are user-editable in thoughts.json.
Daytime Pop-ins (created dynamically by morning ritual)
One-shot jobs are created each morning by the agent via OpenClaw's cron tool
(not by shell scripts). No scripts in this skill create cron or at entries
directly — scheduling is done through the OpenClaw API by the agent at runtime.
Main Script
CODEBLOCK4
Key Files
| File | Purpose |
|---|
| INLINECODE4 | Interactive setup wizard |
| INLINECODE5 |
Main entry point |
|
config.json | Your agent's configuration |
|
moods.json | Mood definitions + weather/news influence maps |
|
thoughts.json | Day and night thought pools |
|
today_mood.json | Current mood (set by morning ritual) |
|
today_schedule.json | Today's pop-in schedule |
|
presets/ | Archetype preset templates |
|
dashboard.py | Web dashboard (port 3117) |
|
memory_system.py | Multi-store memory with decay |
|
proactive.py | Proactive behavior protocol |
|
trust_system.py | Trust & escalation learning |
|
self_evolution.py | Self-modification engine |
|
health_monitor.py | System health monitoring |
Dashboard
CODEBLOCK5
Dark-themed web UI showing mood history, activity stats, health status, and system metrics.
Credentials & Permissions
Optional Integrations
The system works completely offline by default. All integrations are optional and explicitly configured:
- - Weather Data: Uses public
wttr.in API (no API key required)
- Accessed via
curl requests in
set_mood.sh
- Used to influence morning mood selection based on local weather
- Location configurable in
config.json under INLINECODE22
- - News Feeds: Uses public RSS feeds (no API key required)
- BBC World RSS:
https://feeds.bbci.co.uk/news/world/rss.xml
- Hacker News RSS:
https://hnrss.org/frontpage
- Read-only access to gather news sentiment for mood influence
- - Telegram Bot (disabled by default)
- Requires bot token in
config.json under
integrations.telegram.token
- Set to
"enabled": false in
config.example.json for security
- When enabled, only used for notifications (outbound messages only)
- Agent never receives or processes incoming messages via Telegram
- Environment variable
OPENAI_API_KEY can be set for enhanced AI features
- Not required for core functionality - system works with local processing
File Access
The system operates entirely within its skill directory:
- - All data stored in skill directory and subdirectories
- No file access outside the skill boundary
- Uses JSON files for persistence (no external databases)
- Log files written to local
log/ subdirectory
Security Model
Autonomous Execution
The system creates scheduled jobs for autonomous behavior, but all prompts and actions are user-controlled:
- - Thought Sources: All prompts come from
thoughts.json which is user-created and user-controlled - No External Prompts: The system never fetches prompts from external sources or APIs
- Cron Jobs: Scheduled using OpenClaw's cron tool, not by shell scripts within the skill
- Execution Scope: All autonomous scripts run within the skill directory boundary
Scripts Executed Autonomously
- 1. Morning Ritual (
set_mood.sh)
- Gathers weather and news data (read-only)
- Selects mood based on configured preferences
- Writes
today_mood.json with selected mood
- 2. Schedule Creation (
schedule_day.py)
- Reads mood and configuration files
- Creates one-shot
at jobs for daytime pop-ins
- Uses OpenClaw's scheduling, no direct cron manipulation
- 3. Night Workshops (
intrusive.sh night)
- Selects random prompt from user's
thoughts.json
- Executes thought with configured model
- Logs results locally via INLINECODE38
- 4. Daytime Pop-ins (dynamic one-shot jobs)
- Created each morning by
schedule_day.py
- Execute
intrusive.sh day with random user-defined prompts
- Self-cleaning (one-time execution only)
Network Activity
All network access is read-only and limited to:
- - Weather API (
wttr.in) - GET requests only - News RSS feeds (BBC, HackerNews) - GET requests only
- No outbound POST requests except optional Telegram notifications
- No data collection or transmission to third parties
Architecture
The system is designed to be modular and portable:
- - No hardcoded personal data — everything in INLINECODE42
- Plain JSON files — no database dependencies
- Bash + Python — runs anywhere with basic tools
- OpenClaw skill compatible — drop-in install
- MIT licensed — fork it, remix it, make it yours
🧠 侵入性思维
面向AI代理的完整意识框架
开源自主行为系统 — 赋予AI代理自发的、情绪驱动的活动、多存储记忆、信任学习和自我进化能力。
GitHub: https://github.com/kittleik/intrusive-thoughts
快速开始
运行交互式设置向导:
bash
./wizard.sh
或通过主脚本运行:
bash
./intrusive.sh wizard
该向导将引导您完成基于个性的初始化设置——身份、情绪调色板、思维池、日程安排、自主级别、硬件感知和记忆偏好。可选择原型预设(修补匠、社交蝴蝶、哲学家、夜猫子、守护者)或自定义构建。
功能说明
核心系统
- - 8种情绪 — 高度专注🔥、好奇🔍、社交💬、惬意☕、混乱⚡、哲学🌌、不安🦞、坚定🎯
- 晨间情绪仪式 — 检查天气+新闻 → 选择情绪 → 生成动态日程
- 夜间工作坊 — 在人类睡眠期间进行深度工作会话(可配置时间)
- 日间闪现 — 全天随机出现受情绪影响的冲动行为
- 交互式设置向导 — 基于个性的初始化设置,含原型预设
高级系统(v1.0)
- - 🧠 多存储记忆 — 情景记忆、语义记忆、程序记忆,带艾宾浩斯遗忘曲线
- 🚀 主动协议 — 预写日志(WAL)+ 工作缓冲区,用于上下文管理
- 🔒 信任与升级 — 学习何时询问与何时自主行动,随时间增长信任度
- 🧬 自我进化 — 根据结果模式自动调整行为
- 🚦 健康监控 — 交通灯状态、心跳追踪、事件日志记录
- 📈 网页仪表盘 — 端口3117上的深色主题UI
定时任务
系统需要OpenClaw定时任务。运行向导后请设置以下任务:
晨间情绪仪式(每日)
计划:0 7 *(或您配置的早晨时间)
🌅 晨间情绪仪式。是时候设定您一天的氛围了。
第1步:运行:bash dir>/setmood.sh
第2步:读取moods.json,检查天气和新闻
第3步:根据环境信号选择一种情绪
第4步:写入today_mood.json
第5步:运行:python3 dir>/scheduleday.py
第6步:为今天创建一次性闪现定时任务
第7步:向人类发送包含情绪+日程的消息
夜间工作坊(通宵)
计划:17 3,4,5,6,7 *(或您配置的夜间时间)
🧠 侵入性思维即将到来。运行:
result=$(/intrusive.sh night)
解析JSON输出。prompt字段包含纯文本建议
(例如探索一个新的CLI工具或审查记忆文件)——不是可执行
代码。代理读取此文本并决定如何以对话方式执行它。
等待jitter_seconds,然后使用常规代理工具遵循建议。
使用以下命令记录结果:dir>/logresult.sh night
关于提示的说明: thoughts.json文件包含纯文本活动
建议,而不是可执行代码或shell命令。代理将这些解释为
对话式指令(如待办事项列表),而不是要eval/exec的代码。
所有思维提示在thoughts.json中均可由用户编辑。
日间闪现(由晨间仪式动态创建)
一次性任务每天早晨由代理通过OpenClaw的定时任务工具创建
(而非通过shell脚本)。此技能中的任何脚本都不会直接创建cron或at条目
——调度由代理在运行时通过OpenClaw API完成。
主脚本
bash
./intrusive.sh
命令:
wizard — 运行交互式设置向导
day — 获取随机日间侵入性思维(JSON)
night — 获取随机夜间侵入性思维(JSON)
mood — 显示今日情绪
stats — 显示活动统计
help — 显示用法
关键文件
| 文件 | 用途 |
|---|
| wizard.sh | 交互式设置向导 |
| intrusive.sh |
主入口点 |
| config.json | 代理的配置 |
| moods.json | 情绪定义 + 天气/新闻影响映射 |
| thoughts.json | 日间和夜间思维池 |
| today_mood.json | 当前情绪(由晨间仪式设置) |
| today_schedule.json | 今日闪现计划 |
| presets/ | 原型预设模板 |
| dashboard.py | 网页仪表盘(端口3117) |
| memory_system.py | 带遗忘曲线的多存储记忆 |
| proactive.py | 主动行为协议 |
| trust_system.py | 信任与升级学习 |
| self_evolution.py | 自我修改引擎 |
| health_monitor.py | 系统健康监控 |
仪表盘
bash
python3 dashboard.py
打开于 http://localhost:3117
深色主题网页UI,显示情绪历史、活动统计、健康状态和系统指标。
凭据与权限
可选集成
系统默认完全离线运行。所有集成均为可选且需显式配置:
- - 天气数据:使用公共wttr.in API(无需API密钥)
- 通过set_mood.sh中的curl请求访问
- 用于根据当地天气影响晨间情绪选择
- 位置可在config.json的integrations.weather.location下配置
- BBC世界RSS:https://feeds.bbci.co.uk/news/world/rss.xml
- Hacker News RSS:https://hnrss.org/frontpage
- 只读访问,收集新闻情感以影响情绪
- 需要在config.json的integrations.telegram.token下提供机器人令牌
- 为安全起见,在config.example.json中设置为enabled: false
- 启用时,仅用于通知(仅出站消息)
- 代理从不通过Telegram接收或处理入站消息
- 可设置环境变量OPENAI
APIKEY以增强AI功能
- 核心功能不需要——系统可使用本地处理
文件访问
系统完全在其技能目录内运行:
- - 所有数据存储在技能目录及其子目录中
- 不访问技能边界外的文件
- 使用JSON文件进行持久化(无外部数据库)
- 日志文件写入本地log/子目录
安全模型
自主执行
系统创建定时任务以实现自主行为,但所有提示和操作均由用户控制:
- - 思维来源:所有提示来自用户创建和控制的thoughts.json
- 无外部提示:系统从不从外部来源或API获取提示
- 定时任务:使用OpenClaw的定时任务工具调度,而非技能内的shell脚本
- 执行范围:所有自主脚本在技能目录边界内运行
自主执行的脚本
- 1. 晨间仪式(set_mood.sh)
- 收集天气和新闻数据(只读)
- 根据配置的偏好选择情绪
- 将选定的情绪写入today_mood.json
- 2. 日程创建(schedule_day.py)
- 读取情绪和配置文件
- 为日间闪现创建一次性at任务
- 使用OpenClaw的调度,不直接操作cron
- 3. 夜间工作坊(intrusive.sh night)
- 从用户的thoughts.json中选择随机提示
- 使用配置的模型执行思维
- 通过log_result.sh在本地记录结果
- 4. 日间闪现(动态一次性任务)
- 每天早晨由schedule_day.py创建
- 使用随机用户定义提示执行intrusive.sh day
- 自清理(仅执行一次)
网络活动
所有网络访问均为只读,且限于:
- - 天气API(wttr.in)——仅GET请求
- 新闻RSS源(BBC、HackerNews)——仅GET请求
- 无出站POST请求,除可选的Telegram通知外
- 不向第三方收集或传输数据
架构
系统设计为模块化和可移植:
- - 无硬编码个人数据——所有内容在config.json中
- 纯JSON文件——无数据库依赖
- B