diff --git a/AGENTS.md b/AGENTS.md index 35f6193..28357fa 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,8 +10,7 @@ - Config load order: `~/.picobot/config.json` then fallback to `./config.json` (`src/config/mod.rs:237-267`) - `.env` (cwd) is loaded with a custom parser, not via dotenv crate; env var placeholders `` in config JSON are substituted -- Config example: `config.example.json` -- `session_ttl_hours` defaults to 4 in code when absent (`src/gateway/mod.rs:44`); config.example.json shows 168 as a suggestion +- Config example: `resources/templates/config.example.json` (released to `~/.picobot/` on first run) ## Tests diff --git a/README.md b/README.md index c0aada6..72a313d 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ graph LR Providers --> PT["type (openai / anthropic)
base_url
api_key
extra_headers"] Models --> MT["model_id
temperature
max_tokens"] Agents --> AT["provider (ref)
model (ref)
max_tool_iterations
token_limit"] - Gateway --> GT["host / port
session_ttl_hours
cleanup_interval_minutes
session_db_path
scheduler"] + Gateway --> GT["host / port
session_db_path
scheduler"] Channels --> CT["feishu: app_id, app_secret
allow_from, agent, media_dir"] ``` @@ -234,8 +234,6 @@ The `.env` file in the working directory is loaded manually (not via dotenv crat |-----|------|---------|-------------| | `host` | string | `127.0.0.1` | Bind address | | `port` | u16 | `19876` | Listen port | -| `session_ttl_hours` | number | `4` | Inactive session expiration (hours) | -| `cleanup_interval_minutes` | number | `60` | Session cleanup interval | | `session_db_path` | string | workspace `picobot.db` | SQLite database path | | `scheduler.enabled` | bool | `false` | Enable cron scheduler | @@ -402,6 +400,8 @@ Integration tests are `#[ignore]` by default because they make real API calls. │ ├── test.env.example # Test environment template │ └── test.env # Actual test keys (gitignored) ├── reference/ # Third-party reference code (do not modify) +├── resources/ # Assets embedded in binary +│ └── templates/ # Templates released to ~/.picobot/ on first run ├── config.example.json # Full config example └── Cargo.toml ``` diff --git a/config.example.json b/resources/templates/config.example.json similarity index 95% rename from config.example.json rename to resources/templates/config.example.json index 25c62be..e0bd112 100644 --- a/config.example.json +++ b/resources/templates/config.example.json @@ -46,8 +46,7 @@ }, "gateway": { "host": "127.0.0.1", - "port": 19876, - "session_ttl_hours": 168 + "port": 19876 }, "client": { "gateway_url": "ws://127.0.0.1:19876/ws" @@ -67,7 +66,6 @@ "consolidation_provider": null, "consolidation_model": null, "recall_limit": 5, - "consolidation_turn_threshold": 10, "idle_consolidation_minutes": 10, "timeline_retention_days": 90, "max_failures_before_degrade": 3 diff --git a/src/config/mod.rs b/src/config/mod.rs index c9bb2ab..a39e39f 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -233,9 +233,6 @@ pub struct MemoryConfig { /// Max knowledge entries injected into system prompt per turn. #[serde(default = "default_recall_limit")] pub recall_limit: usize, - /// Number of turns without consolidation before forcing one. - #[serde(default = "default_consolidation_turn_threshold")] - pub consolidation_turn_threshold: usize, /// Idle minutes before triggering consolidation (for async channels). #[serde(default = "default_idle_consolidation_minutes")] pub idle_consolidation_minutes: u64, @@ -253,7 +250,6 @@ impl Default for MemoryConfig { consolidation_provider: None, consolidation_model: None, recall_limit: 5, - consolidation_turn_threshold: 10, idle_consolidation_minutes: 10, timeline_retention_days: 90, max_failures_before_degrade: 3, @@ -274,7 +270,6 @@ impl MemoryConfig { } fn default_recall_limit() -> usize { 5 } -fn default_consolidation_turn_threshold() -> usize { 10 } fn default_idle_consolidation_minutes() -> u64 { 10 } fn default_timeline_retention_days() -> u64 { 90 } fn default_max_failures_before_degrade() -> usize { 3 } diff --git a/src/gateway/mod.rs b/src/gateway/mod.rs index eb15578..d4ce0ad 100644 --- a/src/gateway/mod.rs +++ b/src/gateway/mod.rs @@ -378,4 +378,14 @@ fn ensure_default_config_files() { tracing::info!(path = %user_path.display(), "Released default USER.md template"); } } + + let config_example_path = picobot_dir.join("config.example.json"); + if !config_example_path.exists() { + let content = include_str!("../../resources/templates/config.example.json"); + if let Err(e) = std::fs::write(&config_example_path, content) { + tracing::warn!(path = %config_example_path.display(), error = %e, "Failed to write config.example.json template"); + } else { + tracing::info!(path = %config_example_path.display(), "Released config.example.json template"); + } + } }