Skip to content
Agentmart
Submit a tool

monitor

Spawn a conditional stream watcher as an ECA background task so the LLM sees matches only.

Skill by ChetanKoneru

IndexedGPL-3.0
Write a review

Chalk Labs

Need help deploying monitor?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/chetankoneru-monitor

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Spawn a conditional stream watcher as an ECA background task so the LLM sees matches only. Use instead of repeated MCP polling whenever the user asks to watch, monitor, or be alerted to a condition on a cluster, log tail, or any long-running producer.

Use cases: ml, productivity, agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/monitor

What's inside

Skill name
monitor
Description
Spawn a conditional stream watcher as an ECA background task so the LLM sees matches only. Use instead of repeated MCP polling whenever the user asks to watch, monitor, or be alerted to a condition on a cluster, log tail, or any long-running producer.
License
GPL-3.0
Instructions
160 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Conditional Monitor via ECA Background Tasks

Use this skill when the user asks for long-running observation: "monitor", "watch for", "let me know if/when", "keep an eye on", "alert me if". The monitor runs in a background shell job; the filter runs in the child process, so non-matching lines never reach the conversation context.

## When to reach for this instead of MCP polling

- Watching k8s events/pods/deployments for a condition (CrashLoopBackOff, rollout stall, Warning events).
- Tailing logs for an error pattern (stern, kubectl logs, journalctl, plain files).
- Following any shell-producible stream (splunk CLI stream, redis monitor, tcpdump, etc.) for a specific trigger.

Do not use for one-shot queries. If the user wants a single snapshot, call the relevant MCP tool directly (`k8s-events`, `k8s-resources-list`, `splunk-search`).

## Tool

`tools/monitor/monitor.bb` in this repo. Invoke via its absolute path. No MCP registration - it is a plain Babashka script driven by ECA background jobs.

Flags:

- `--source "<shell cmd>"` - the long-running producer. Runs under `sh -c <cmd>`; on kill the monitor destroys the whole descendant tree.
- Exactly one filter: `--jq <expr>` | `--regex <pat>` | `--grep <substring>`.
- `--live` - push each match into the active ECA chat via `emacsclient --eval '(eca-chat-send-prompt "monitor: ...")'`. Wakes the agent on every match without user input. Requires Emacs server on PATH. Implies `--max-matches` defaults to unlimited.
- `--max-matches <n>` - exit 0 after N matches. Default: 1 without `--live`, unlimited with `--live`.
- `--max-runtime <sec>` - hard ceiling on total runtime. Recommended for any ad-hoc watch so a forgotten monitor cannot linger.

Stdout is match-only. Stderr carries the startup banner and source errors.

## Choosing a mode

| User phrasing | Mode |
|---|---|
| "let me know when X happens" + they will be active in the chat anyway | Default (no `--live`). Monitor exits on first match; the hit surfaces on the user's next turn via ECA's queued completion message. |
| "alert me the moment X happens, I may not be looking" | `--live`. Monitor stays running and pushes each match into the chat immediately, waking the agent. |
| "watch this continuously and react to everything" | `--live`. |
| "wait for X once in the background while I do other things" | `--live --max-matches 1 --max-runtime <sec>`. Fires once, pushes, exits. |
| "give me a periodic pulse of what the cluster/log is doing, but not the firehose" | `--digest-interval <sec> --live`. Every N seconds a dedup+top-N histogram pushes into the chat. Filter optional. |
| "report every 2 minutes on what's happening, only the relevant bits" | `--digest-interval 120 --live` (with or without filter). |

Rules of thumb:

- `--live` without `--digest-interval`: per-match push. Good for rare events. Bad for chatty sources (one agent turn per match = token burn).
- `--digest-interval N --live`: time-windowed push. Good for noisy sources. At most one agent turn per N seconds.
- `--digest-interval N` without `--live`: accumulate but write only to bg-job stdout. Peek manually.
- Always pair any long-running mode with `--max-runtime` so forgotten monitors self-terminate.

## Lifecycle: start, peek, stop

### 1. Start

Pick a short descriptive label for `background=` so multiple monitors are distinguishable in `eca__bg_job list`.

```
eca__shell_command
  command    = /<abs repo path>/tools/monitor/monitor.bb --source '<cmd>' --jq '<expr>' --live --max-runtime 600
  background = <label like k8s-warnings-prod>
```

Returns `job-N`. Record the id. Default to `--live --max-runtime 600` (10 minutes) for ad-hoc watches; drop `--live` only when the user explicitly wants the exit-then-piggyback mode; raise `--max-runtime` only when the user has asked for a longer watch explicitly.

### 2. Peek

On your own cadence (natural turn boundaries, not in a tight loop), read new output:

```
eca__bg_job action=read_output job_id=job-N
```

- Empty result - nothing fired, negligible token cost, move on.
- Non-empty result - one or more pre-filtered matches, one per line. Reason about them, report to the user, take follow-up actions with other MCP tools if needed.

### 3. Stop

When the user changes focus, the task completes, or the session is ending:

```
eca__bg_job action=kill job_id=job-N
```

Always kill monitors you started. They do not auto-stop when the source is long-running.

## Session hygiene

- Before starting a new monitor, call `eca__bg_job action=list`. If an identical monitor (same source + filter) is already running, reuse its job id instead of spawning a second one.
- When the user changes what to watch, kill the obsolete monitor before starting the replacement.
- Peek at natural points in the conversation (after answering a question, before asking the user for the next step). Do not open a polling loop that does nothing but peek.

## Choosing a filter

| Source output               | Filter                                  |
|-----------------------------|-----------------------------------------|
| ND-JSON (e.g. `kubectl -w -o json`, `stern -o json`) | `--jq` with `select(cond) \| {reshape}` |
| Plain text logs             | `--regex` (anchored patterns, alternations) |
| Plain text, simple keyword  | `--grep` (literal substring, no regex escaping) |

With `--jq`, combine selection and projection in one expression so emissions are compact:

```
select(.type == "Warning") | {ns: .involvedObject.namespace, kind: .involvedObject.kind, name: .involvedObject.name, reason: .reason, msg: .message}
```

## Recipes

### k8s Warning events

```
--source "kubectl get events -A -w -o json"
--jq    'select(.type == "Warning") | {ns: .involvedObject.namespace, kind: .involvedObject.kind, name: .involvedObject.name, reason: .reason, msg: .message}'
```

### Pods entering CrashLoopBackOff

```
--source "kubectl get pods -A -w -o json"
--jq    'select((.status.containerStatuses // [])[]?.state.waiting.reason == "CrashLoopBackOff") | {ns: .metadata.namespace, pod: .metadata.name}'
```

### Deployment rollout stall (replicas not advancing)

```
--source "kubectl get deploy -A -w -o json"

From ChetanKoneru/death-contraptions, GPL-3.0.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Apr 23, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
GPL-3.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get monitor running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying monitor?

CallGet help
Cite this page

monitor skill. Agent Mart. https://agentmart.dev/skills/chetankoneru-monitor (last updated 2026-10-24)