repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

extensions/pulse/README.md

Raw

pulse

Living documentation sync for Pi.

Tracks configured docs and applies validated model-proposed updates after workspace changes or periodic checks.

Install / load

Loaded through the root pi-ext package. See root README.

Commands / tools / settings

Commands: one Pi slash command: /pulse.

Subcommands:

Completions:

Tools: none.

Hooks:

Settings live under the pulse key in Pi settings. Global defaults use ~/.pi/agent/settings.json; project overrides use .pi/settings.json.

{
  "pulse": {
    "documents": [{ "path": "README.md" }],
    "model": "minimax/MiniMax-M3",
    "interval": 10,
    "apply": "auto"
  }
}

Config fields:

Document fields:

Env vars: none.

Behavior

Markdown source
File outline
# pulse

Living documentation sync for Pi.

Tracks configured docs and applies validated model-proposed updates after
workspace changes or periodic checks.

## Install / load

Loaded through the root pi-ext package.
See [root README](../../README.md).

## Commands / tools / settings

Commands:
one Pi slash command: `/pulse`.

Subcommands:

- `/pulse help`
- `/pulse init`
- `/pulse add <file> [note]`
- `/pulse add-dir <dir> <glob> [note]`
- `/pulse add-glob <glob> [note]`
- `/pulse remove <path|index>`
- `/pulse list`
- `/pulse status`
- `/pulse force`
- `/pulse pause`
- `/pulse resume`

Completions:

- subcommand names
- file names for `/pulse add`
- directory names for `/pulse add-dir`
- tracked doc paths for `/pulse remove`

Tools:
none.

Hooks:

- `session_start`:
  loads settings, restores last run state, starts timer when docs exist.
- `session_shutdown`:
  stops timer.
- `agent_start`:
  refreshes status when tracking and not paused.
- `tool_execution_end`:
  marks workspace dirty after `edit` or `write`; treats `bash` as maybe dirty
  and checks git status before auto-sync.
- `agent_end`:
  runs an automatic check when tracking is active and ready.

Settings live under the `pulse` key in Pi settings.
Global defaults use `~/.pi/agent/settings.json`; project overrides use `.pi/settings.json`.

```json
{
  "pulse": {
    "documents": [{ "path": "README.md" }],
    "model": "minimax/MiniMax-M3",
    "interval": 10,
    "apply": "auto"
  }
}
```

Config fields:

- `documents`:
  tracked document specs.
- `model`:
  optional default model override, format `provider/id`.
- `interval`:
  periodic check interval in minutes.
  Default `10`.
  `0` disables periodic checks.
- `apply`:
  `auto`, `confirm`, or `review`.
  Default `auto`.

Document fields:

- `path`:
  file path, directory path, or glob pattern.
- `type`:
  `file`, `dir`, or `glob`.
  Default `file`.
- `glob`:
  glob used with `type: "dir"`.
  Default `**/*.md`.
- `instruction`:
  optional per-doc note sent with content.
- `model`:
  optional per-doc model override, format `provider/id`.

Env vars:
none.

## Behavior

- `/pulse init` creates `.pi/settings.json` with a `pulse` section; it tracks
  root `README*` files and `AGENTS.md` when present.
- `/pulse add` requires an existing file.
- `/pulse add-dir` requires an existing directory and explicit glob.
- `/pulse add-glob` stores an explicit glob pattern.
- `/pulse remove` accepts a tracked path or zero-based index.
- `/pulse force` runs a manual check unless paused.
- `/pulse pause` stops timer-driven checks.
  `/pulse resume` restarts them.
- Absolute paths and `..` path escapes are rejected.
  Existing symlinks resolving outside the workspace are rejected or skipped.
- Invalid config fields make the config unloadable.
  Invalid document specs make the config unloadable.
- Dir and glob specs expand to sorted files; duplicate paths are ignored.
- Automatic checks wait for Pi idle, a 60 second quiet window after mutations,
  and a 5 minute cooldown after the last update.
- Periodic checks use `interval`; dirty checks also run after workspace-changing
  tools settle.
- Bash output is not parsed.
  Bash only marks the workspace maybe dirty; Pulse compares `git status
  --porcelain=v1 -z --untracked-files=all` when available.
- The model receives tracked docs plus the last 50 conversation messages.
  It gets no tools.
- Model output must be JSON updates for allowed paths only.
  Unknown paths, duplicate paths, invalid JSON, and unchanged content are
  rejected or skipped.
- Invalid JSON gets up to 2 correction retries before the check fails.
- `auto` writes validated updates.
  `confirm` asks before writing.
  `review` opens each proposed file in an editor before writing.
- Writes are refused if a tracked file changed between load and apply.
- Last run state is stored in the session as `pulse-state`.