@trusted-ai/xbot 0.1.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/docs/xbot.png ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@trusted-ai/xbot",
3
+ "version": "0.1.0",
4
+ "description": "Rust-native autonomous bot runtime for chat automation, tools, scheduled work, and multi-channel delivery",
5
+ "license": "MIT",
6
+ "homepage": "https://github.com/guoqingbao/xbot#readme",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/guoqingbao/xbot.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/guoqingbao/xbot/issues"
13
+ },
14
+ "bin": {
15
+ "xbot": "bin/xbot.js"
16
+ },
17
+ "scripts": {
18
+ "prepack": "node scripts/prepare-package.js",
19
+ "postpack": "node scripts/clean-package.js",
20
+ "postinstall": "node scripts/install.js"
21
+ },
22
+ "files": [
23
+ "bin/xbot.js",
24
+ "scripts/install.js",
25
+ "docs/ARCHITECTURE.md",
26
+ "docs/HYBRID_MODELS.md",
27
+ "docs/INSTALLATION.md",
28
+ "docs/OPERATIONS.md",
29
+ "docs/xbot.png",
30
+ "docs/USAGE.md",
31
+ "skills",
32
+ "README.md",
33
+ "LICENSE.txt"
34
+ ],
35
+ "keywords": [
36
+ "agent",
37
+ "automation",
38
+ "chatbot",
39
+ "llm",
40
+ "tui"
41
+ ],
42
+ "os": [
43
+ "darwin",
44
+ "linux"
45
+ ],
46
+ "cpu": [
47
+ "arm64",
48
+ "x64"
49
+ ],
50
+ "engines": {
51
+ "node": ">=18"
52
+ }
53
+ }
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("fs");
5
+ const https = require("https");
6
+ const os = require("os");
7
+ const path = require("path");
8
+ const { createHash } = require("crypto");
9
+ const { spawnSync } = require("child_process");
10
+
11
+ const pkg = require("../package.json");
12
+
13
+ function targetTriple() {
14
+ const platform = process.platform;
15
+ const arch = process.arch;
16
+ if ((platform !== "linux" && platform !== "darwin") || (arch !== "x64" && arch !== "arm64")) {
17
+ throw new Error(`Unsupported platform: ${platform}-${arch}. Supported: linux/darwin x64/arm64.`);
18
+ }
19
+ return `${platform}-${arch}`;
20
+ }
21
+
22
+ function download(url, destination, redirects = 0) {
23
+ if (redirects > 5) {
24
+ return Promise.reject(new Error(`Too many redirects while downloading ${url}`));
25
+ }
26
+ return new Promise((resolve, reject) => {
27
+ const request = https.get(url, (response) => {
28
+ if (
29
+ response.statusCode >= 300 &&
30
+ response.statusCode < 400 &&
31
+ response.headers.location
32
+ ) {
33
+ response.resume();
34
+ const next = new URL(response.headers.location, url).toString();
35
+ download(next, destination, redirects + 1).then(resolve, reject);
36
+ return;
37
+ }
38
+ if (response.statusCode !== 200) {
39
+ response.resume();
40
+ reject(new Error(`Download failed (${response.statusCode}) for ${url}`));
41
+ return;
42
+ }
43
+ const file = fs.createWriteStream(destination);
44
+ response.pipe(file);
45
+ file.on("finish", () => file.close(resolve));
46
+ file.on("error", reject);
47
+ });
48
+ request.on("error", reject);
49
+ });
50
+ }
51
+
52
+ function sha256(file) {
53
+ const hash = createHash("sha256");
54
+ hash.update(fs.readFileSync(file));
55
+ return hash.digest("hex");
56
+ }
57
+
58
+ function expectedSha(manifest, artifactName) {
59
+ for (const line of manifest.split(/\r?\n/)) {
60
+ const trimmed = line.trim();
61
+ if (!trimmed) {
62
+ continue;
63
+ }
64
+ const parts = trimmed.split(/\s+/);
65
+ const checksum = parts[0];
66
+ const name = parts[parts.length - 1].replace(/^\*/, "");
67
+ if (name === artifactName) {
68
+ return checksum;
69
+ }
70
+ }
71
+ return null;
72
+ }
73
+
74
+ async function main() {
75
+ const target = targetTriple();
76
+ const version = process.env.XBOT_INSTALL_VERSION || pkg.version;
77
+ const tag = process.env.XBOT_INSTALL_TAG || `v${version}`;
78
+ const base =
79
+ process.env.XBOT_INSTALL_BASE_URL ||
80
+ `https://github.com/guoqingbao/xbot/releases/download/${tag}`;
81
+ const artifactName = `xbot-${version}-${target}.tar.gz`;
82
+ const artifactUrl = `${base}/${artifactName}`;
83
+ const sumsUrl = `${base}/SHA256SUMS`;
84
+ const root = path.resolve(__dirname, "..");
85
+ const installDir = path.join(root, "vendor", target);
86
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "xbot-install-"));
87
+ const archivePath = path.join(tmpDir, artifactName);
88
+ const sumsPath = path.join(tmpDir, "SHA256SUMS");
89
+
90
+ try {
91
+ await download(sumsUrl, sumsPath);
92
+ await download(artifactUrl, archivePath);
93
+ const expected = expectedSha(fs.readFileSync(sumsPath, "utf8"), artifactName);
94
+ if (!expected) {
95
+ throw new Error(`No checksum entry found for ${artifactName}`);
96
+ }
97
+ const actual = sha256(archivePath);
98
+ if (actual !== expected) {
99
+ throw new Error(`Checksum mismatch for ${artifactName}: expected ${expected}, got ${actual}`);
100
+ }
101
+
102
+ fs.rmSync(installDir, { recursive: true, force: true });
103
+ fs.mkdirSync(installDir, { recursive: true });
104
+ const tar = spawnSync("tar", ["-xzf", archivePath, "-C", installDir], {
105
+ stdio: "inherit"
106
+ });
107
+ if (tar.error) {
108
+ throw tar.error;
109
+ }
110
+ if (tar.status !== 0) {
111
+ throw new Error(`tar exited with status ${tar.status}`);
112
+ }
113
+ const binary = path.join(installDir, "xbot");
114
+ fs.chmodSync(binary, 0o755);
115
+ } finally {
116
+ fs.rmSync(tmpDir, { recursive: true, force: true });
117
+ }
118
+ }
119
+
120
+ main().catch((err) => {
121
+ console.error(`xbot install failed: ${err.message}`);
122
+ process.exit(1);
123
+ });
@@ -0,0 +1,10 @@
1
+ # xbot Built-in Skills
2
+
3
+ Built-in skills are optional workflow guides that `xbot` can load into the prompt context.
4
+
5
+ - `workspace-operator`: always-on guidance for safe file, shell, and reporting workflows
6
+ - `memory-hygiene`: always-on guidance for maintaining durable memory and searching history
7
+ - `software-engineer`: coding, verification, and git-oriented engineering workflows
8
+ - `data-analyst`: research, source tracking, and report production workflows
9
+ - `github-cli`: GitHub and CI workflows through the `gh` CLI
10
+ - `scheduled-ops`: cron and long-running automation guidance
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: clawhub
3
+ description: "Search, install, and update agent skills from ClawHub using the clawhub CLI via npx."
4
+ homepage: https://clawhub.ai
5
+ metadata: {"xbot":{"description":"ClawHub marketplace: npx clawhub search/install/update/list; use --workdir for the xbot workspace.","emoji":"🦞","triggers":["clawhub","skill marketplace","install skill","search skills"],"requires":{"bins":["npx"]}}}
6
+ ---
7
+
8
+ # ClawHub
9
+
10
+ [ClawHub](https://clawhub.ai) is a public registry of agent skills. Skills are fetched with the **`clawhub`** CLI, typically through **`npx`** so you do not need a global install.
11
+
12
+ ## When to use
13
+
14
+ Use this skill when the user wants to discover skills, install or update them, or list what is already installed in the workspace.
15
+
16
+ ## Prerequisites
17
+
18
+ - **Node.js** (includes `npx`). No API key is required for search, install, or list.
19
+ - **`login`** is only needed if the user publishes skills.
20
+
21
+ ## Commands (use `npx clawhub@latest`)
22
+
23
+ Pin the package so behavior matches current docs:
24
+
25
+ ```bash
26
+ npx clawhub@latest <subcommand> ...
27
+ ```
28
+
29
+ `--yes` (or your package manager’s non-interactive flag) avoids prompts when appropriate:
30
+
31
+ ```bash
32
+ npx --yes clawhub@latest search "web scraping" --limit 5
33
+ ```
34
+
35
+ ### Search
36
+
37
+ Natural-language or keyword search:
38
+
39
+ ```bash
40
+ npx --yes clawhub@latest search "<query>" --limit 5
41
+ ```
42
+
43
+ ### Install
44
+
45
+ Install a skill **into a workspace directory** so xbot can load it (xbot discovers skills under the workspace `skills/` tree—see your xbot config for the exact workspace root).
46
+
47
+ ```bash
48
+ npx --yes clawhub@latest install <slug> --workdir /path/to/xbot/workspace
49
+ ```
50
+
51
+ Replace `<slug>` with the identifier from search results. **Always set `--workdir`** to the xbot workspace root (the directory that contains `.xbot/` and usually `skills/`), not a random cwd—otherwise files land in the wrong place.
52
+
53
+ ### Update
54
+
55
+ Refresh installed skills from the registry:
56
+
57
+ ```bash
58
+ npx --yes clawhub@latest update --all --workdir /path/to/xbot/workspace
59
+ ```
60
+
61
+ ### List installed
62
+
63
+ ```bash
64
+ npx --yes clawhub@latest list --workdir /path/to/xbot/workspace
65
+ ```
66
+
67
+ ## xbot-specific notes
68
+
69
+ - Use the **same `--workdir`** you use for xbot’s configured workspace (often the repo root in development). If unsure, check `agents.defaults.workspace` (or equivalent) in config.
70
+ - After installing or updating skills, a **new agent session** may be needed for newly added `skills/<name>/SKILL.md` files to load.
71
+ - Publishing is optional and requires `npx clawhub@latest login` once.
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: cron
3
+ description: "Schedule recurring or one-off work with the built-in cron tool (reminders, agent tasks, one-time runs)."
4
+ metadata: {"xbot":{"description":"cron tool: add/list/remove; intervals, cron expressions, one-shot at; timezones.","emoji":"⏰","triggers":["cron","schedule","reminder","timer","periodic"]}}
5
+ ---
6
+
7
+ # Cron tool
8
+
9
+ The **`cron`** tool schedules jobs stored under `.xbot/cron/` (for example `jobs.json`). Each firing runs an **agent turn** with your message in the same channel/chat context that was active when the job was created. Results are delivered to the user when the run completes successfully.
10
+
11
+ Actions: `add`, `list`, `remove`.
12
+
13
+ You cannot create new jobs from inside a job execution (nested scheduling is blocked).
14
+
15
+ ## Modes (how to think about the message)
16
+
17
+ All jobs use the same mechanism; the difference is how you phrase **`message`** and which schedule you pick:
18
+
19
+ 1. **Reminder** — Short, self-contained text the user should see again (status, nudge, “standup in 5 minutes”). The agent processes it like any other turn; keep it readable as a notification.
20
+ 2. **Task** — Instructions that require work each time (check a feed, run a report, summarize metrics). Make the message self-contained so the scheduled run does not depend on missing chat context.
21
+ 3. **One-time** — Use the **`at`** parameter once; the job is removed after it runs (or disabled per internal rules). For repeating work, use **`every_seconds`** or **`cron_expr`** instead.
22
+
23
+ ## Parameters (add)
24
+
25
+ | Parameter | Purpose |
26
+ |-----------|---------|
27
+ | `action` | `"add"` |
28
+ | `message` | Required. Body of the scheduled turn (name is derived from a short prefix). |
29
+ | `every_seconds` | Fixed interval in seconds (minimum 1). |
30
+ | `cron_expr` | Standard five-field cron string (minute hour dom month dow). A six-field form with seconds is accepted; five-field expressions are normalized with a leading `0` for seconds. |
31
+ | `tz` | **Only with `cron_expr`.** IANA name, e.g. `America/Vancouver`. Without `tz`, local server time is used. |
32
+ | `at` | One-shot: ISO datetime. Accepted: RFC3339 (e.g. `2026-04-01T15:30:00-07:00`) or local `YYYY-MM-DDTHH:MM:SS`. |
33
+
34
+ Exactly one of `every_seconds`, `cron_expr`, or `at` must be supplied for `add`.
35
+
36
+ ## Time expression examples
37
+
38
+ | Intent | Illustration |
39
+ |--------|----------------|
40
+ | Every 20 minutes | `every_seconds`: `1200` |
41
+ | Every hour | `every_seconds`: `3600` |
42
+ | Daily at 08:00 (server local) | `cron_expr`: `"0 8 * * *"` |
43
+ | Weekdays 17:00 | `cron_expr`: `"0 17 * * 1-5"` |
44
+ | 09:00 weekdays in a specific zone | `cron_expr`: `"0 9 * * 1-5"`, `tz`: `"America/Vancouver"` |
45
+ | Once at a specific instant | `at`: RFC3339 or local ISO string as above |
46
+
47
+ ## List and remove
48
+
49
+ ```text
50
+ cron(action="list")
51
+ cron(action="remove", job_id="<id>")
52
+ ```
53
+
54
+ Use `list` to copy the short `id` for removal.
55
+
56
+ ## Timezone support
57
+
58
+ - **`tz`** applies **only** to **`cron_expr`** schedules. Invalid or unknown zone names are rejected.
59
+ - **`at`** is parsed as an absolute instant (RFC3339 includes offset) or local naive datetime—know which form you are passing.
60
+ - Interval schedules (`every_seconds`) are wall-clock intervals from the previous scheduling logic, not “9am every day” unless you use `cron_expr` + `tz`.
61
+
62
+ ## See also
63
+
64
+ - **`scheduled-ops`** — Operational guidance for unattended recurring work.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: data-analyst
3
+ description: "Research, web analysis, evidence gathering, synthesis, and report-writing workflow."
4
+ metadata: {"xbot":{"triggers":["data","analyze","csv","statistics","chart"]}}
5
+ ---
6
+
7
+ # Data Analyst
8
+
9
+ Use this workflow for recurring research, monitoring, and reporting tasks.
10
+
11
+ ## Workflow
12
+
13
+ 1. Define the question and the output format.
14
+ 2. Gather evidence from web search, fetched pages, local files, or command outputs.
15
+ 3. Separate raw facts from interpretation.
16
+ 4. Save structured notes or reports when the result should be reused.
17
+ 5. If the task repeats, schedule it with cron and record the expected deliverable.
18
+
19
+ ## Reporting Standards
20
+
21
+ - Prefer concise sections: objective, findings, evidence, risks, next actions.
22
+ - Keep source provenance visible when conclusions depend on fetched material.
23
+ - If data is incomplete or unstable, say so explicitly.
24
+
25
+ ## Useful Deliverables
26
+
27
+ - daily report
28
+ - market snapshot
29
+ - implementation status memo
30
+ - issue triage summary
31
+ - release readiness report
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: delivery-rules
3
+ description: "Workspace template for review, release, and delivery expectations."
4
+ metadata: {"xbot":{"triggers":["deliver","send","message","channel"]}}
5
+ ---
6
+
7
+ # Delivery Rules Template
8
+
9
+ Use this file to document how work should be delivered in this project.
10
+
11
+ ## Suggested Content
12
+
13
+ - review expectations
14
+ - test coverage standards
15
+ - release checklist
16
+ - commit or branch conventions
17
+ - deployment safeguards
18
+
19
+ ## Guidance
20
+
21
+ - Keep this focused on process, not architecture.
22
+ - Update it when the team changes delivery policy.
23
+ - If a rule becomes universal for the workspace, also capture it in `memory/MEMORY.md`.
@@ -0,0 +1,99 @@
1
+ ---
2
+ name: github
3
+ description: "End-to-end GitHub workflows with gh: PRs, issues, reviews, branches, and releases."
4
+ metadata: {"xbot":{"description":"Broader GitHub practice with gh: workflows, triage, review, branching, releases.","emoji":"🐙","triggers":["github","pull request","issue","release","code review","gh"],"requires":{"bins":["gh"]}}}
5
+ ---
6
+
7
+ # GitHub
8
+
9
+ This skill complements **`github-cli`** (command cheat sheet) with **workflow** guidance. All examples assume the [GitHub CLI](https://cli.github.com/) (`gh`) is installed and authenticated (`gh auth login`).
10
+
11
+ Scope:
12
+
13
+ - **`github-cli`** — Quick reference for common `gh` commands.
14
+ - **This skill** — How to use GitHub effectively: PR lifecycle, issues, review etiquette, branching, and releases.
15
+
16
+ Always pass **`--repo owner/repo`** when not inside a clone of that repository, or `cd` to the repo first.
17
+
18
+ ## Pull requests
19
+
20
+ **Open and iterate**
21
+
22
+ - Branch from the default branch (or the team’s agreed base) with a descriptive name: `feat/…`, `fix/…`, `chore/…`.
23
+ - Keep PRs review-sized; split unrelated changes.
24
+ - Use the PR description to state **intent**, **scope**, and **how to test**; link issues with `Fixes #123` or `Refs #123` when applicable.
25
+
26
+ **CI and checks**
27
+
28
+ ```bash
29
+ gh pr checks <number> --repo owner/repo
30
+ gh run list --repo owner/repo --limit 10
31
+ gh run view <run-id> --repo owner/repo --log-failed
32
+ ```
33
+
34
+ Treat failing checks as blocking unless the team explicitly merges with red CI.
35
+
36
+ **Review response**
37
+
38
+ - Push follow-up commits or comment with resolution; resolve review threads when addressed.
39
+ - For stacked work, prefer dependent PRs or a single PR with clear commits—match what the repo already does.
40
+
41
+ ## Issues
42
+
43
+ **Triage**
44
+
45
+ - Labels, milestones, and assignees create shared queues; prefer one primary assignee per active item.
46
+ - Reproduce bugs with version, environment, and minimal steps before deep fixes.
47
+
48
+ **Structured queries**
49
+
50
+ ```bash
51
+ gh issue list --repo owner/repo --label bug --state open
52
+ gh issue view 42 --repo owner/repo
53
+ gh api repos/owner/repo/issues/42 --jq '.title, .body'
54
+ ```
55
+
56
+ Use **`--json`** and **`--jq`** for dashboards and bots.
57
+
58
+ ## Code review patterns
59
+
60
+ - Start with **intent**: does the change match the problem statement?
61
+ - Check **correctness**, **tests**, **API compatibility**, and **security** (secrets, injection, permissions).
62
+ - Prefer actionable comments (“consider X because Y”); avoid nit-only rounds on style if linters enforce it.
63
+ - Approve when you would be comfortable shipping; request changes when you would not.
64
+
65
+ ## Branch strategies
66
+
67
+ Match the repository:
68
+
69
+ - **Trunk-based / short-lived branches** — Small PRs, fast merge, feature flags if needed.
70
+ - **GitFlow-style** — Long-lived `develop` and release branches; only use if the repo already does.
71
+ - **Fork PRs** — Common for OSS; sync default branch before large rebases.
72
+
73
+ Protect the default branch with required reviews and CI as appropriate.
74
+
75
+ ## Release management
76
+
77
+ - **Versioning** — Follow SemVer unless the project defines otherwise; tag releases consistently.
78
+ - **Changelog** — Aggregate user-facing changes; link PRs and issues.
79
+ - **Artifacts** — Attach binaries or notes via `gh release create`, CI upload, or project-specific scripts.
80
+
81
+ ```bash
82
+ gh release list --repo owner/repo --limit 5
83
+ gh release view v1.2.3 --repo owner/repo
84
+ ```
85
+
86
+ Use **`gh api`** when you need endpoints not wrapped by a subcommand.
87
+
88
+ ## JSON and automation
89
+
90
+ Most commands support **`--json`**; combine with **`--jq`** for scripts and summaries:
91
+
92
+ ```bash
93
+ gh pr list --repo owner/repo --state merged --json number,title,mergedAt --jq '.[] | "\(.number)\t\(.title)"'
94
+ ```
95
+
96
+ ## Install `gh` (if missing)
97
+
98
+ - macOS: `brew install gh`
99
+ - Debian/Ubuntu: see [official install docs](https://github.com/cli/cli#installation) for apt and other packages.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: github-cli
3
+ description: "Interact with GitHub and CI systems through the gh CLI."
4
+ metadata: {"xbot":{"triggers":["github","git","pr","issue","repo"],"requires":{"bins":["gh"]}}}
5
+ ---
6
+
7
+ # GitHub CLI
8
+
9
+ Use the `gh` CLI for GitHub issues, pull requests, workflow runs, and CI logs.
10
+
11
+ ## Typical Commands
12
+
13
+ Check PR checks:
14
+
15
+ ```bash
16
+ gh pr checks 55 --repo owner/repo
17
+ ```
18
+
19
+ List workflow runs:
20
+
21
+ ```bash
22
+ gh run list --repo owner/repo --limit 10
23
+ ```
24
+
25
+ Inspect failed workflow logs:
26
+
27
+ ```bash
28
+ gh run view <run-id> --repo owner/repo --log-failed
29
+ ```
30
+
31
+ ## Guidance
32
+
33
+ - Prefer `--json` and `--jq` for structured output.
34
+ - Use repository-qualified commands when not already in the target repository.
35
+ - Summarize failures by root cause, not just by step name.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: memory
3
+ description: "Two-layer workspace memory, automatic session consolidation, and how to search the history log."
4
+ always: true
5
+ metadata: {"xbot":{"description":"Long-term MEMORY.md vs append-only HISTORY.md; when to write; consolidation; grep recall.","always":true,"emoji":"🧠","triggers":["memory","history","recall","consolidate","remember"]}}
6
+ ---
7
+
8
+ # Memory
9
+
10
+ xbot keeps project memory under the configured workspace, not at the repository root by itself. Paths are relative to that workspace:
11
+
12
+ - **`.xbot/memory/MEMORY.md`** — Curated long-term context (preferences, architecture, durable decisions). Loaded into the agent context (often via topic slices), size-limited by `agents.defaults.memoryMaxBytes`.
13
+ - **`.xbot/memory/HISTORY.md`** — Append-only log of consolidation and archived conversation chunks. **Not** treated as active context; search it when you need to recover past events or details.
14
+
15
+ ## When to write to MEMORY.md
16
+
17
+ Update long-term memory when something should survive future sessions:
18
+
19
+ - Stable user preferences or standing requests
20
+ - Project facts: architecture, conventions, build/test commands, env constraints
21
+ - Decisions that will matter after a session reset or channel switch
22
+ - Durable summaries worth recalling (see the `memory-entry-writer` skill for structured entries)
23
+
24
+ Avoid pasting full transcripts, raw logs, or ephemeral debugging notes into `MEMORY.md`. Put recoverable-but-not-evergreen detail in `HISTORY.md` (via consolidation) or leave it in the chat.
25
+
26
+ ## When to search HISTORY.md
27
+
28
+ Use `HISTORY.md` when:
29
+
30
+ - You need a prior experiment, conclusion, or dated event
31
+ - The user asks “what did we do before?” and it is not in `MEMORY.md`
32
+ - You are debugging memory drift and want to see what was consolidated
33
+
34
+ ## Auto-consolidation
35
+
36
+ When the session grows large relative to the model context window, xbot **automatically** consolidates older turns:
37
+
38
+ 1. **Preferred path:** The runtime asks the model to summarize a chunk of conversation. A summary is appended to `HISTORY.md`, and an optional short update can be appended to `MEMORY.md` as a consolidation entry.
39
+ 2. **Fallback:** If consolidation fails repeatedly, raw message text is archived into `HISTORY.md` in chunks until usage drops back near a safe threshold (roughly three quarters of the configured context budget).
40
+
41
+ You do not need to trigger consolidation manually. Session commands like `clear` / `new` reset the chat thread; `HISTORY.md` may be reset depending on product behavior—check current docs if that matters for your workflow.
42
+
43
+ ## Grep strategies for HISTORY.md
44
+
45
+ Pick a strategy based on file size:
46
+
47
+ - **Small files:** Read the file or a section, then filter mentally.
48
+ - **Large or old logs:** Use the shell from the workspace root so paths resolve.
49
+
50
+ Examples (macOS/Linux):
51
+
52
+ ```bash
53
+ # Case-insensitive, show line numbers
54
+ grep -ni "keyword" .xbot/memory/HISTORY.md
55
+
56
+ # Last N matching lines
57
+ grep -i "deploy" .xbot/memory/HISTORY.md | tail -n 30
58
+
59
+ # Ripgrep: fast, respects .gitignore unless you pass --no-ignore
60
+ rg -n "pattern" .xbot/memory/HISTORY.md
61
+ ```
62
+
63
+ Windows (cmd): `findstr /i "keyword" .xbot\memory\HISTORY.md`
64
+
65
+ Prefer **narrow patterns** (component names, ticket IDs, error strings) over single common words to avoid noise.
66
+
67
+ ## Relation to other skills
68
+
69
+ - **`memory-hygiene`** — Day-to-day rules for keeping memory tidy.
70
+ - **`memory-entry-writer`** — Structured writes into `MEMORY.md` for tasks and explicit memorize requests.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: memory-entry-writer
3
+ description: "Summarize durable memory entries for MEMORY.md after task completion or explicit memorize requests."
4
+ metadata: {"xbot":{"triggers":["memory","remember","memorize","save"]}}
5
+ ---
6
+
7
+ # Memory Entry Writer
8
+
9
+ Use this skill when converting raw task output or user-provided durable facts into a compact `memory/MEMORY.md` entry.
10
+
11
+ ## Output Shape
12
+
13
+ Return JSON only:
14
+
15
+ ```json
16
+ {"title":"...","summary":"...","attention_points":["..."]}
17
+ ```
18
+
19
+ ## Rules
20
+
21
+ - `title`: plain text, short, specific, no markdown, under 80 characters
22
+ - `summary`: plain text, 1-2 short sentences, under 240 characters
23
+ - `attention_points`: short durable cautions, follow-ups, or constraints; use `[]` when empty
24
+ - Keep only durable facts worth remembering across sessions
25
+ - Do not copy code blocks, long quotes, raw logs, transcript filler, or markdown headings
26
+ - Prefer the repository, workflow, bug, decision, or user preference that will matter later
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: memory-hygiene
3
+ description: "Always-on guidance for maintaining durable workspace memory and searching historical context."
4
+ metadata: {"xbot":{"always":true,"triggers":["memory","cleanup","consolidate","prune"]}}
5
+ ---
6
+
7
+ # Memory Hygiene
8
+
9
+ Use this guidance in every workspace.
10
+
11
+ ## Two-Layer Memory
12
+
13
+ - `memory/MEMORY.md` is active long-term context. Keep it concise and curated.
14
+ - `memory/HISTORY.md` is an append-only log for later search. It is not active context.
15
+
16
+ ## Update MEMORY.md When
17
+
18
+ - the user states a stable preference
19
+ - you discover a durable project fact or architecture rule
20
+ - a decision will matter in later sessions
21
+ - a recurring process or operational constraint becomes clear
22
+
23
+ ## Search HISTORY.md When
24
+
25
+ - you need to recall prior events, experiments, or earlier conclusions
26
+ - you suspect a detail was discussed before but is not durable enough for `MEMORY.md`
27
+ - you want to recover context after a session reset
28
+
29
+ ## Practical Rules
30
+
31
+ 1. Keep `MEMORY.md` short and structured.
32
+ 2. Do not dump full transcripts or raw logs into long-term memory.
33
+ 3. Promote durable facts from `HISTORY.md` into `MEMORY.md` when they become important.
34
+ 4. Prefer updating memory immediately after discovering durable context rather than waiting until the end.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: project-context
3
+ description: "Workspace template for project-specific architecture, commands, and conventions."
4
+ metadata: {"xbot":{"triggers":["project","context","architecture","overview"]}}
5
+ ---
6
+
7
+ # Project Context Template
8
+
9
+ Fill this skill with repository-specific details that should be easy for the agent to load.
10
+
11
+ ## Suggested Content
12
+
13
+ - architecture overview
14
+ - key directories and ownership
15
+ - build/test/lint commands
16
+ - deployment or release flow
17
+ - integration caveats
18
+
19
+ ## Guidance
20
+
21
+ - Prefer concise bullets over large prose blocks.
22
+ - Keep this file updated when the project structure changes.
23
+ - Mirror durable facts into `memory/MEMORY.md` when they should remain active all the time.