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 ../../README.md.

Commands / tools / settings

Commands: one Pi slash command, /pulse.

Subcommands:

Completions:

Tools: none.

Hooks:

Settings live in .pi/pulse.json:

{
  "documents": [{ "path": "README.md" }],
  "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 [../../README.md](../../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`
- `/pulse config`

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 config, restores last run state, starts config watcher, starts timer
  when docs exist.
- `session_shutdown`:
  stops watcher and 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 in `.pi/pulse.json`:

```json
{
  "documents": [{ "path": "README.md" }],
  "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/pulse.json`; 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.
- `/pulse config` opens `.pi/pulse.json` in an editor.
- 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 persisted document specs are dropped while loading config.
- Dir and glob specs expand to sorted files; duplicate paths are ignored.
- Automatic checks wait for Pi idle, a quiet window after mutations, and a
  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 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.
- `.pi/pulse.json` is watched and reloaded after changes.
- Last run state is stored in the session as `pulse-state`.