@senad-d/observme 0.1.0 → 0.1.2

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +103 -13
  3. package/SECURITY.md +1 -1
  4. package/dashboards/observme-slos.yaml +1 -1
  5. package/docs/README.md +54 -0
  6. package/docs/agent-subagent-observability-requirements.md +34 -38
  7. package/docs/configuration.md +9 -0
  8. package/docs/extension-integration.md +222 -0
  9. package/docs/reference/00-README.md +81 -0
  10. package/{ObservMe-Production-Docs → docs/reference}/05-otel-pipeline-and-collector.md +5 -0
  11. package/{ObservMe-Production-Docs → docs/reference}/07-extension-implementation-blueprint.md +18 -7
  12. package/{ObservMe-Production-Docs → docs/reference}/pi-session-format.md +1 -1
  13. package/docs/review-validation.md +1 -1
  14. package/docs/validation-flow.md +8 -1
  15. package/examples/README.md +52 -0
  16. package/examples/collector.yaml +5 -0
  17. package/examples/integrations/subagent-runner.ts +262 -0
  18. package/examples/observme.yaml +4 -0
  19. package/img/demo.gif +0 -0
  20. package/img/observme-command.png +0 -0
  21. package/img/observme-conversations.png +0 -0
  22. package/img/observme-dashboards.png +0 -0
  23. package/img/observme-overview.png +0 -0
  24. package/img/observme-trace.png +0 -0
  25. package/package.json +11 -2
  26. package/skills/observme-docs/SKILL.md +65 -0
  27. package/src/integration.ts +134 -0
  28. package/src/pi/handlers.ts +11 -0
  29. package/src/pi/integration-api.ts +224 -0
  30. package/src/pi/subagent-spawn.ts +1 -1
  31. package/tsconfig.json +1 -1
  32. package/ObservMe-Production-Docs/00-README.md +0 -79
  33. /package/{ObservMe-Production-Docs → docs/reference}/01-requirements-and-scope.md +0 -0
  34. /package/{ObservMe-Production-Docs → docs/reference}/02-reference-architecture.md +0 -0
  35. /package/{ObservMe-Production-Docs → docs/reference}/03-pi-event-and-session-model.md +0 -0
  36. /package/{ObservMe-Production-Docs → docs/reference}/04-telemetry-semantic-conventions.md +0 -0
  37. /package/{ObservMe-Production-Docs → docs/reference}/06-security-privacy-redaction.md +0 -0
  38. /package/{ObservMe-Production-Docs → docs/reference}/08-query-grafana-integration.md +0 -0
  39. /package/{ObservMe-Production-Docs → docs/reference}/09-dashboards-alerts-slos.md +0 -0
  40. /package/{ObservMe-Production-Docs → docs/reference}/10-testing-release-operations.md +0 -0
  41. /package/{ObservMe-Production-Docs → docs/reference}/11-deployment-runbooks.md +0 -0
  42. /package/{ObservMe-Production-Docs → docs/reference}/12-configuration-reference.md +0 -0
  43. /package/{ObservMe-Production-Docs → docs/reference}/13-source-notes.md +0 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,9 @@
4
4
 
5
5
  ### Added
6
6
 
7
+ - Added a packaged `observme-docs` Pi skill that routes natural-language ObservMe questions to focused user, operator, reference, example, and contributor documentation through Pi's normal skill discovery, without an ObservMe system-prompt hook.
8
+ - Added a versioned `@senad-d/observme/integration` event-bus API and transport-agnostic child-runner example for parent-side spawn/wait/join telemetry and child process lineage propagation.
9
+ - Added README tables cataloging available metrics, trace spans, and structured log events, including opt-in and reserved signals.
7
10
  - Expanded the Grafana suite with SLO Health, Trace Journey, Agent Node Graphs, and LLM Conversations dashboards, plus richer multi-agent, cost, latency, tool, model, log, and export-health views.
8
11
  - Added correlated, content-safe telemetry for tool results, agent runs, workflows, subagent lifecycle events, interactive Bash executions, and configuration failures.
9
12
  - Added W3C trace continuation for launcher-propagated parent contexts, with sanitized lineage validation and fail-safe span-link/log fallbacks.
@@ -12,6 +15,9 @@
12
15
 
13
16
  ### Changed
14
17
 
18
+ - Moved the detailed technical reference into `docs/reference/` and updated package, documentation, examples, dashboards, tests, and skill routes to use the new location.
19
+ - Made the packaged `observme-docs` skill resolve routed references from its installed package root instead of the caller's working directory or a repository checkout.
20
+ - Reorganized documentation around `docs/README.md`, a categorized technical-reference index, and an example guide with explicit usage and safety notes.
15
21
  - Split Pi event handling into focused lifecycle, agent/turn, LLM, tool/Bash, and session modules while preserving the `registerHandlers()` facade.
16
22
  - Centralized telemetry conventions, content-capture policy, sensitive-value rejection, diagnostic sanitization, Grafana transport, `/obs` command plumbing, and trusted-project configuration bootstrap.
17
23
  - Improved all dashboards with emitted-label-safe queries, selected-range calculations, zero/no-data states, bounded tables, canonical SLO formulas, and time-preserving Loki/Tempo drill-downs.
package/README.md CHANGED
@@ -42,8 +42,10 @@ ObservMe maps Pi lifecycle and session events to OpenTelemetry traces, metrics,
42
42
  - [Implementation Status](#implementation-status)
43
43
  - [Quick Start](#quick-start)
44
44
  - [Installation](#installation)
45
+ - [Extension Integration](#extension-integration)
45
46
  - [Commands](#commands)
46
47
  - [Architecture](#architecture)
48
+ - [Available Telemetry](#available-telemetry)
47
49
  - [Configuration and Privacy](#configuration-and-privacy)
48
50
  - [Safety Model](#safety-model)
49
51
  - [Dashboards and Examples](#dashboards-and-examples)
@@ -56,7 +58,7 @@ ObservMe maps Pi lifecycle and session events to OpenTelemetry traces, metrics,
56
58
 
57
59
  ## Implementation Status
58
60
 
59
- This checkout implements the ObservMe MVP scope from the packaged `ObservMe-Production-Docs/00-README.md` design overview:
61
+ This checkout implements the ObservMe MVP scope described by the packaged [`docs/reference/00-README.md`](docs/reference/00-README.md) technical reference:
60
62
 
61
63
  - Extension load checks and `/obs health` backend checks.
62
64
  - Session, workflow, agent-run, turn, LLM, tool, bash, subagent-spawn, wait/join, compaction, branch, model-change, and thinking-level telemetry.
@@ -66,8 +68,6 @@ This checkout implements the ObservMe MVP scope from the packaged `ObservMe-Prod
66
68
  - Grafana dashboard JSON, alert rules, SLO definitions, Collector examples, and compatibility matrix artifacts.
67
69
  - Unit, contract, integration, chaos/failure, performance, package, and smoke-test coverage in the validation pipeline.
68
70
 
69
- The repository version is currently `0.1.0`. Run the validation commands below before publishing or deploying a release build.
70
-
71
71
  ## Quick Start
72
72
 
73
73
  Use this checklist to confirm telemetry end to end. You need a supported Pi installation; see the [compatibility matrix](docs/compatibility-matrix.md). If you already have an OTLP Collector and Grafana stack, skip the first step.
@@ -144,6 +144,31 @@ pi --no-extensions -e .
144
144
  | Git | `pi install git:senad-d/ObservMe` | Install from Git; use a tag or commit when you need a fixed version. |
145
145
  | Local checkout | `pi --no-extensions -e .` | Develop or test this repository. |
146
146
 
147
+ The package also includes the `observme-docs` skill. Pi can load it automatically for natural-language ObservMe questions, or you can invoke it explicitly with `/skill:observme-docs`. The skill reads only the relevant packaged documentation and cites the matching file and section. ObservMe registers no system-prompt hook; Pi exposes the skill through its normal skill-discovery metadata.
148
+
149
+ ## Extension Integration
150
+
151
+ Orchestrators, subagent runners, process managers, remote executors, and other Pi extensions can request ObservMe's versioned integration API through `pi.events`. The API records parent-side spawn/wait/join telemetry and returns the sanitized environment that must be passed to each child Pi process for workflow, agent-lineage, and W3C trace propagation.
152
+
153
+ ```typescript
154
+ import { requestObservMeIntegration } from "@senad-d/observme/integration";
155
+
156
+ const observme = requestObservMeIntegration(pi);
157
+ const started = observme?.startSubagent({
158
+ command: "pi",
159
+ spawnType: "extension",
160
+ spawnReason: "delegated_task",
161
+ env: process.env,
162
+ });
163
+
164
+ if (started?.ok) {
165
+ await launchChildPi({ env: started.env });
166
+ observme.completeSubagent(started.spawnId, { childStatus: "active" });
167
+ }
168
+ ```
169
+
170
+ Use [`docs/extension-integration.md`](docs/extension-integration.md) for the complete lifecycle and API contract. The shipped [`examples/integrations/subagent-runner.ts`](examples/integrations/subagent-runner.ts) wraps a generic child transport, while [`docs/agent-subagent-observability-requirements.md`](docs/agent-subagent-observability-requirements.md) covers the larger orchestration design.
171
+
147
172
  ## Commands
148
173
 
149
174
  All commands are registered under `/obs`.
@@ -183,7 +208,67 @@ Grafana
183
208
 
184
209
  The extension factory in `src/extension.ts` only registers handlers and commands. OTEL SDK startup happens from `session_start`, and bounded flush/shutdown happens from `session_shutdown`, so importing or registering the extension does not open exporters, timers, or sockets.
185
210
 
186
- See `ObservMe-Production-Docs/02-reference-architecture.md` for the full architecture. Implementation planning specs are repository-only and live at <https://github.com/senad-d/ObservMe/tree/main/specs>. A reference Docker Compose deployment of the Grafana/Tempo/Loki/Prometheus/Collector stack is also repository-only at <https://github.com/senad-d/ObservMe/tree/main/observability-stack> because it contains generated local credentials and state placeholders.
211
+ ## Available Telemetry
212
+
213
+ Traces, metrics, and logs are enabled by default and can be disabled independently in configuration. The names below are the OpenTelemetry instrument, span, and `event.name` values defined by ObservMe; backend ingestion may normalize dotted names. The tables identify reserved or registered names that do not yet have a live recording point. Other signals appear only after their corresponding Pi lifecycle event occurs.
214
+
215
+ Metric labels are intentionally low-cardinality. Session, workflow, agent, trace, span, and entry IDs are available on correlated spans and logs, but are not added to Prometheus labels. Prometheus-compatible backends expose histograms as the usual `_bucket`, `_sum`, and `_count` series.
216
+
217
+ ### Metrics
218
+
219
+ | Type | Area | Available metrics | What they show |
220
+ | --- | --- | --- | --- |
221
+ | Counter | Sessions and workflows | `observme_sessions_started_total`<br>`observme_sessions_shutdown_total`<br>`observme_workflows_started_total`<br>`observme_workflows_completed_total`<br>`observme_workflow_errors_total` | Session lifecycle and root-workflow outcomes. |
222
+ | Counter | Agents and subagents | `observme_agent_runs_total`<br>`observme_agent_run_errors_total`<br>`observme_subagents_spawned_total`<br>`observme_subagent_spawn_failures_total`<br>`observme_orphan_agents_total`<br>`observme_trace_context_propagation_failures_total`<br>`observme_child_agent_failures_total`<br>`observme_parent_recovered_from_child_failure_total` | Agent activity, lineage health, child failures, and parent recovery. |
223
+ | Counter | Turns and LLM requests | `observme_turns_started_total`<br>`observme_turns_completed_total`<br>`observme_llm_requests_total`<br>`observme_llm_errors_total` | Turn throughput and provider request outcomes. |
224
+ | Counter | LLM tokens and cost | `observme_llm_input_tokens_total`<br>`observme_llm_output_tokens_total`<br>`observme_llm_cache_read_tokens_total`<br>`observme_llm_cache_write_tokens_total`<br>`observme_llm_cache_write_1h_tokens_total`<br>`observme_llm_reasoning_tokens_total`<br>`observme_llm_total_tokens_total`<br>`observme_llm_cost_usd_total` | Provider-reported token usage, cache usage, reasoning usage, and USD cost. Values are recorded when the provider supplies them. |
225
+ | Counter | Tools and Bash | `observme_tool_calls_total`<br>`observme_tool_failures_total`<br>`observme_bash_executions_total`<br>`observme_bash_failures_total` | Tool and interactive Bash volume and failures. |
226
+ | Counter | Session changes | `observme_model_changes_total`<br>`observme_thinking_level_changes_total`<br>`observme_compactions_total`<br>`observme_branches_total` | Model/thinking changes, compactions, and branch creation. |
227
+ | Counter | ObservMe health | `observme_telemetry_dropped_total`<br>`observme_export_errors_total`<br>`observme_redaction_failures_total`<br>`observme_events_observed_total`<br>`observme_handler_errors_total` | Local drops, export/redaction failures, handler activity, and handler failures. |
228
+ | Histogram | Workflow and agent tree | `observme_workflow_duration_ms`<br>`observme_agent_run_duration_ms`<br>`observme_subagent_spawn_duration_ms`<br>`observme_agent_wait_duration_ms`<br>`observme_agent_join_duration_ms`<br>`observme_agent_tree_depth`<br>`observme_agent_tree_width`<br>`observme_agent_fanout_count` | Workflow/agent latency and multi-agent tree shape. |
229
+ | Histogram | Operation latency | `observme_turn_duration_ms`<br>`observme_llm_request_duration_ms`<br>`observme_tool_duration_ms`<br>`observme_bash_duration_ms`<br>`observme_handler_duration_ms` | End-to-end operation and extension-handler duration in milliseconds. |
230
+ | Histogram | Context and payload size | `observme_compaction_tokens_before`<br>`observme_prompt_size_chars`<br>`observme_response_size_chars`<br>`observme_tool_result_size_chars` | Context size before compaction and payload sizes in characters. Size metrics do not contain payload content. |
231
+ | Up-down counter | Current activity | `observme_active_spans`<br>`observme_active_agents` | Active operations and agents for the current exported stream. |
232
+ | Registered, not yet recorded | Agent lifetime | `observme_agent_lifetime_duration_ms` | Reserved instrument; the current live handlers do not record measurements yet. |
233
+ | Registered, not yet recorded | Official GenAI compatibility | `gen_ai.client.token.usage`<br>`gen_ai.client.operation.duration` | Reserved OpenTelemetry GenAI instruments; use the `observme_llm_*` metrics above for current data. |
234
+
235
+ ### Traces
236
+
237
+ | Span name | Created for | Notes |
238
+ | --- | --- | --- |
239
+ | `pi.session` | A trusted Pi session | Root session span. It remains open during the session and is ended, flushed, and exported on `session_shutdown`. |
240
+ | `pi.agent.run` | An agent run | Child of the session span; records run identity, lineage, source, duration, and status. |
241
+ | `pi.agent.spawn` | A subagent launch | Records spawn type/reason, child identity, propagation outcome, duration, and failure status. |
242
+ | `pi.agent.wait` | Waiting for a child agent | Correlates the parent, child, spawn, wait reason, and duration. |
243
+ | `pi.agent.join` | Joining a child agent | Records child/join status, failure propagation or recovery, and duration. |
244
+ | `pi.turn` | An agent turn | Child of the active agent run when available; contains turn, model, and lineage metadata. |
245
+ | `pi.llm.request` | An LLM provider request | Records provider/model, API, usage, cost, stop reason, duration, and status. Redacted content attributes are opt-in. |
246
+ | `pi.tool.call` | A Pi tool call | Records safe tool metadata, result size, duration, success, and bounded error class. Arguments/results are opt-in. |
247
+ | `pi.bash.execution` | Interactive Bash execution | Records exit/cancel/truncation metadata, output size, duration, and status. Commands/output are opt-in. Tool-driven Bash remains a `pi.tool.call` span. |
248
+ | `pi.compaction` | Session compaction | Records compaction reason, token count, summary metadata, and file-count metadata. |
249
+ | `pi.branch` | Session-tree branch creation | Records source/destination entry metadata, branch summary metadata, and file counts. |
250
+ | `pi.model.change` | Model change | Reserved span name. Current live telemetry adds a `model.changed` event to `pi.session` and emits a structured log instead of a standalone span. |
251
+ | `pi.thinking.change` | Thinking-level change | Reserved span name. Current live telemetry adds a `thinking.changed` event to `pi.session` and emits a structured log instead of a standalone span. |
252
+
253
+ ### Logs
254
+
255
+ All operational logs use short event bodies plus structured attributes. Correlation fields include available session, workflow, agent, agent-run, turn, trace, and span IDs. Raw prompts, responses, thinking, tool data, Bash data, paths, and error messages are excluded unless their specific capture setting is enabled and the value passes the redaction policy.
256
+
257
+ | Area | Available `event.name` values | Availability and purpose |
258
+ | --- | --- | --- |
259
+ | Configuration, session, and workflow | `config.rejected`<br>`session.started`<br>`session.shutdown`<br>`session.duplicate_start`<br>`workflow.started`<br>`workflow.completed`<br>`workflow.failed` | Configuration diagnostics and top-level lifecycle/outcome events. |
260
+ | Reserved session events | `session.named`<br>`session.error` | Public event names reserved for compatibility; current live handlers do not emit them. |
261
+ | Agent run | `agent.run.started`<br>`agent.run.completed`<br>`agent.run.failed` | Agent-run lifecycle and outcome. |
262
+ | Subagent lineage | `agent.spawn.started`<br>`agent.spawn.completed`<br>`agent.spawn.failed`<br>`agent.wait.started`<br>`agent.wait.completed`<br>`agent.join.started`<br>`agent.join.completed`<br>`agent.orphaned`<br>`trace_context.propagation_failed` | Parent/child lifecycle, lineage gaps, propagation failures, and join outcomes. |
263
+ | Turn | `turn.started`<br>`turn.completed` | Turn lifecycle with run/turn correlation. |
264
+ | LLM lifecycle | `llm.request.started`<br>`llm.request.completed`<br>`llm.request.failed` | Content-free provider request lifecycle, usage, cost, stop reason, and bounded errors. |
265
+ | LLM content | `llm.prompt.captured`<br>`llm.response.captured`<br>`llm.thinking.captured` | Emitted only when the corresponding prompt, response, or thinking capture flag is enabled and redaction succeeds. |
266
+ | Replay | `message.replayed` | Emitted by explicit `/obs backfill` replay; historical replay is disabled by default. |
267
+ | Tools | `tool.call.started`<br>`tool.call.completed`<br>`tool.call.failed` | Content-free tool lifecycle, safe tool metadata, status, and correlation. |
268
+ | Tool content | `tool.error.captured` | Separate failed-tool result log emitted only when `capture.toolResults` is enabled and redaction succeeds. |
269
+ | Bash | `bash.completed` | Interactive Bash completion, status, exit/cancel/truncation metadata, and safe size/hash metadata. |
270
+ | Session changes | `model.changed`<br>`thinking.changed`<br>`branch.created`<br>`compaction.created` | Model/thinking annotations and branch/compaction lifecycle. |
271
+ | ObservMe health | `telemetry.dropped`<br>`redaction.failed`<br>`export.failed`<br>`handler.failed` | Bounded, content-safe diagnostics for the extension's own telemetry pipeline. |
187
272
 
188
273
  ## Configuration and Privacy
189
274
 
@@ -193,8 +278,6 @@ ObservMe supports layered configuration with this precedence:
193
278
  defaults → global ~/.pi/agent/observme.yaml → trusted project config → trusted project .env → system environment variables → runtime options
194
279
  ```
195
280
 
196
- The extension automatically creates `<project>/<CONFIG_DIR_NAME>/observme.yaml` (`<project>/.pi/observme.yaml` in the standard distribution) the first time Pi emits `session_start` in a trusted project and the file does not already exist. It uses Pi's exported config-directory name and serialized file-mutation queue. Pi emits that lifecycle for startup, `/reload`, new-session, resume, and fork flows; ObservMe attempts the same idempotent bootstrap for each trusted flow, skips untrusted projects or contexts without `ctx.cwd`, and never overwrites an existing file. Edit this file for project-specific setup: `otlp.endpoint` / `otlp.signalEndpoints` for your Collector, `resource.attributes` for service/project/tenant/environment identity, `capture` and `privacy` for content visibility, and `query.grafana` plus `query.links.traceUrlTemplate` for `/obs` Grafana commands. The generated starter keeps content-capture flags disabled, `privacy.redactionEnabled: true`, and `privacy.allowUnsafeCapture: false`; for local debugging, set only the needed `capture.*` flags to `true` and keep redaction enabled. Keep secrets out of YAML; use environment variables or a trusted project `.env` for values such as `OBSERVME_OTLP_TOKEN`, `OBSERVME_GRAFANA_TOKEN`, `OBSERVME_GRAFANA_PASSWORD`, and `OBSERVME_HASH_SALT`. See [`docs/configuration.md`](docs/configuration.md) for the quick configuration guide.
197
-
198
281
  Factory-safe loading uses defaults/global/system-environment/runtime options only. Session-scoped loading can add trusted project config and a project-local `.env` when Pi marks the project trusted. `/obs status` reports the effective config source, whether project-local config was loaded, skipped because the project is untrusted, or missing, plus bounded rejection issue codes, the configured Grafana URL, and query-readiness status without rendering tokens or passwords. In untrusted projects, ObservMe does not read project-local config or `.env` files and uses safe defaults/global/system-environment layers instead. Invalid or unsafe configuration emits a bounded `config.rejected` diagnostic and falls back safely without exposing rejected values.
199
282
 
200
283
  Cross-process agent lineage has a separate boundary: only the Pi process environment available to the shipped extension, or explicit runtime options for controlled embedders, is eligible for parent provenance. Project-local `.env` values configure ObservMe but cannot establish lineage. A child accepts only a complete validated workflow/parent/root/depth/spawn envelope and valid W3C context; malformed or stale envelopes fail open to a root/orphan fallback with sanitized telemetry.
@@ -269,7 +352,7 @@ For intentionally raw local debugging only, set `OBSERVME_REDACTION_ENABLED=fals
269
352
 
270
353
  Only new LLM events emitted after these settings and the updated Collector are active can show content; older telemetry dropped by the Collector cannot be recovered. Open the **ObservMe LLM Conversations** dashboard for a dedicated opt-in chat timeline. Do not query Grafana with raw prompt or response text.
271
354
 
272
- Full configuration schema: `ObservMe-Production-Docs/12-configuration-reference.md`. Full redaction/privacy design: `ObservMe-Production-Docs/06-security-privacy-redaction.md`.
355
+ Full configuration schema: `docs/reference/12-configuration-reference.md`. Full redaction/privacy design: `docs/reference/06-security-privacy-redaction.md`.
273
356
 
274
357
  ## Safety Model
275
358
 
@@ -281,7 +364,7 @@ Full configuration schema: `ObservMe-Production-Docs/12-configuration-reference.
281
364
  - `/obs` query commands are read-only and are not imported by telemetry-emission code paths.
282
365
  - Invalid or unsafe configuration falls back to safe defaults with bounded `config.rejected`, `/obs status`, and available Pi UI diagnostics; rejected values are never rendered. Intentionally unsafe capture emits a visible warning.
283
366
 
284
- See [`SECURITY.md`](SECURITY.md) and `ObservMe-Production-Docs/06-security-privacy-redaction.md` for details.
367
+ See [`SECURITY.md`](SECURITY.md) and `docs/reference/06-security-privacy-redaction.md` for details.
285
368
 
286
369
  ## Dashboards and Examples
287
370
 
@@ -290,21 +373,28 @@ These assets are included in the npm package:
290
373
  - Grafana dashboards: `dashboards/observme-*.json`, including Overview, SLO Health, Export Health, Trace Journey, Agents, Agent Node Graphs, Cost, Models, Latency, Tools, Errors, Logs and LLM I/O, LLM Conversations, and Branches/Compactions.
291
374
  - Alert rules: `dashboards/observme-alerts.yaml`.
292
375
  - SLO definitions: `dashboards/observme-slos.yaml`.
293
- - Supported local-stack ObservMe config: `examples/observme.yaml`.
294
- - Production Collector config with high-cardinality and content-drop processors: `examples/collector.yaml`.
295
- - Compatibility matrix: `docs/compatibility-matrix.md`.
376
+ - Example guide and safety notes: [`examples/README.md`](examples/README.md).
377
+ - Transport-agnostic subagent integration example: [`examples/integrations/subagent-runner.ts`](examples/integrations/subagent-runner.ts).
378
+ - Supported local-stack ObservMe config: [`examples/observme.yaml`](examples/observme.yaml).
379
+ - Production Collector config with high-cardinality and content-drop processors: [`examples/collector.yaml`](examples/collector.yaml).
380
+ - Compatibility matrix: [`docs/compatibility-matrix.md`](docs/compatibility-matrix.md).
296
381
 
297
382
  Open **ObservMe Overview** first for health/SLO chips, workload, cost, latency, agent-lineage status, and time-preserving links to focused dashboards. Use **Trace Journey** to follow a session/workflow/agent/run across Prometheus aggregates, Loki logs, and Tempo traces. Use **LLM Conversations** only for redacted opt-in content; raw prompt, response, command, path, and error-message values should never be placed in dashboard URLs or Prometheus labels. Empty failure tables normally mean no matching failures in the selected range, while optional content panels can be empty because capture is disabled by default.
298
383
 
299
- The full dashboard map, standard variables, drill-down workflow, threshold colors, and zero-state semantics are documented in `ObservMe-Production-Docs/09-dashboards-alerts-slos.md`.
384
+ The full dashboard map, standard variables, drill-down workflow, threshold colors, and zero-state semantics are documented in `docs/reference/09-dashboards-alerts-slos.md`.
300
385
 
301
386
  ## Documentation Set
302
387
 
388
+ Start with [`docs/README.md`](docs/README.md), which routes installation, configuration, privacy, telemetry, troubleshooting, operations, architecture, and contributor questions to the smallest relevant document set.
389
+
303
390
  - [`docs/configuration.md`](docs/configuration.md): quick configuration guide.
304
391
  - [`docs/compatibility-matrix.md`](docs/compatibility-matrix.md): supported Pi, Node.js, OpenTelemetry, and local-stack versions.
305
392
  - [`docs/validation-flow.md`](docs/validation-flow.md): secret-safe Grafana and `/obs` troubleshooting flow.
306
- - `ObservMe-Production-Docs/`: architecture, configuration, privacy, dashboards, and operational reference docs.
393
+ - [`docs/extension-integration.md`](docs/extension-integration.md): public API and process-propagation contract for other Pi extensions.
394
+ - [`examples/README.md`](examples/README.md): example selection, usage, and safety guidance.
395
+ - [`docs/reference/00-README.md`](docs/reference/00-README.md): categorized technical reference index.
307
396
  - [`SECURITY.md`](SECURITY.md): security reporting and package safety guidance.
397
+ - [`skills/observme-docs/SKILL.md`](skills/observme-docs/SKILL.md): Pi's progressive-disclosure router for natural-language ObservMe questions.
308
398
 
309
399
  ## Development
310
400
 
package/SECURITY.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Security Policy
2
2
 
3
- ObservMe is a Pi extension that instruments Pi agent sessions and exports OpenTelemetry traces, metrics, and logs to an external observability stack such as an OpenTelemetry Collector, Grafana Tempo, Loki, Prometheus, Mimir, or Grafana Cloud. This policy summarizes the implemented trust model; see `ObservMe-Production-Docs/06-security-privacy-redaction.md` for the full security, privacy, and redaction specification.
3
+ ObservMe is a Pi extension that instruments Pi agent sessions and exports OpenTelemetry traces, metrics, and logs to an external observability stack such as an OpenTelemetry Collector, Grafana Tempo, Loki, Prometheus, Mimir, or Grafana Cloud. This policy summarizes the implemented trust model; see `docs/reference/06-security-privacy-redaction.md` for the full security, privacy, and redaction specification.
4
4
 
5
5
  ## Trust model
6
6
 
@@ -1,5 +1,5 @@
1
1
  version: 1
2
- source: ObservMe-Production-Docs/09-dashboards-alerts-slos.md#12-slos
2
+ source: docs/reference/09-dashboards-alerts-slos.md#12-slos
3
3
  slos:
4
4
  - id: observability-export
5
5
  name: Observability Export SLO
package/docs/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # ObservMe documentation
2
+
3
+ This page is the entry point for ObservMe user, operator, and contributor documentation. Start with the task-oriented guides, then open the deeper reference only when you need implementation or telemetry-contract detail.
4
+
5
+ ## Start here
6
+
7
+ | Goal | Read first | Then, if needed |
8
+ | --- | --- | --- |
9
+ | Install ObservMe and learn `/obs` commands | [`../README.md`](../README.md) | [`configuration.md`](configuration.md) |
10
+ | Configure a trusted project | [`configuration.md`](configuration.md) | [`reference/12-configuration-reference.md`](reference/12-configuration-reference.md) |
11
+ | Validate Grafana and `/obs` together | [`validation-flow.md`](validation-flow.md) | [`reference/11-deployment-runbooks.md`](reference/11-deployment-runbooks.md) |
12
+ | Check supported versions | [`compatibility-matrix.md`](compatibility-matrix.md) | [`reference/10-testing-release-operations.md`](reference/10-testing-release-operations.md) |
13
+ | Understand privacy and content capture | [`../SECURITY.md`](../SECURITY.md) | [`reference/06-security-privacy-redaction.md`](reference/06-security-privacy-redaction.md) |
14
+ | Configure an OTEL Collector | [`../examples/README.md`](../examples/README.md) | [`reference/05-otel-pipeline-and-collector.md`](reference/05-otel-pipeline-and-collector.md) |
15
+ | Understand metrics, spans, logs, and labels | [`../README.md#available-telemetry`](../README.md#available-telemetry) | [`reference/04-telemetry-semantic-conventions.md`](reference/04-telemetry-semantic-conventions.md) |
16
+ | Operate dashboards, alerts, and SLOs | [`../README.md#dashboards-and-examples`](../README.md#dashboards-and-examples) | [`reference/09-dashboards-alerts-slos.md`](reference/09-dashboards-alerts-slos.md) |
17
+ | Understand architecture and lifecycle | [`reference/02-reference-architecture.md`](reference/02-reference-architecture.md) | [`reference/03-pi-event-and-session-model.md`](reference/03-pi-event-and-session-model.md) |
18
+ | Integrate another Pi extension or orchestrator | [`extension-integration.md`](extension-integration.md) | [`agent-subagent-observability-requirements.md`](agent-subagent-observability-requirements.md) |
19
+ | Diagnose parent/subagent lineage | [`agent-subagent-observability-requirements.md`](agent-subagent-observability-requirements.md) | [`reference/03-pi-event-and-session-model.md`](reference/03-pi-event-and-session-model.md) |
20
+
21
+ ## User and operator guides
22
+
23
+ - [`configuration.md`](configuration.md) — project config creation, fields to edit, credentials, privacy defaults, and precedence.
24
+ - [`validation-flow.md`](validation-flow.md) — secret-safe troubleshooting when Grafana or `/obs` does not behave as expected.
25
+ - [`compatibility-matrix.md`](compatibility-matrix.md) — tested Pi, Node.js, OpenTelemetry, Collector, and Grafana-stack versions.
26
+ - [`../examples/README.md`](../examples/README.md) — purpose and safe use of the shipped configuration and integration examples.
27
+ - [`extension-integration.md`](extension-integration.md) — public event-bus API for orchestrators, subagent runners, and other Pi extensions.
28
+ - [`../SECURITY.md`](../SECURITY.md) — package trust model and vulnerability reporting.
29
+
30
+ ## Technical reference
31
+
32
+ [`reference/00-README.md`](reference/00-README.md) is the reference index. Use it for architecture, Pi event mapping, telemetry semantics, Collector design, privacy rules, query behavior, dashboards, testing, deployment, and the complete configuration schema.
33
+
34
+ The reference set is detailed and may describe reserved contracts as well as live behavior. The telemetry tables in [`../README.md#available-telemetry`](../README.md#available-telemetry) identify signals that are reserved or registered but not currently recorded.
35
+
36
+ ## Contributor and design notes
37
+
38
+ These documents support extension development and are not the shortest path for normal setup:
39
+
40
+ - [`STRUCTURE.md`](STRUCTURE.md) — repository structure conventions.
41
+ - [`agent-subagent-observability-requirements.md`](agent-subagent-observability-requirements.md) — complete orchestration and tmux lineage requirements beyond the public integration API.
42
+ - [`configuration-tui-design-standard.md`](configuration-tui-design-standard.md) — reusable configuration TUI visual design.
43
+ - [`review-validation.md`](review-validation.md) — repository review and release-validation evidence.
44
+
45
+ ## Documentation precedence
46
+
47
+ When documents overlap, use this order:
48
+
49
+ 1. [`../README.md`](../README.md) and the task-oriented guides in this directory for current user-facing behavior.
50
+ 2. [`reference/12-configuration-reference.md`](reference/12-configuration-reference.md) for the complete configuration contract.
51
+ 3. The remaining production reference documents for architecture and implementation detail.
52
+ 4. Contributor/design notes for repository work and future integration requirements.
53
+
54
+ If two documents conflict, report the conflict explicitly instead of silently combining them. Never include credentials, raw prompts, raw commands, or other sensitive values in examples or troubleshooting output.
@@ -13,17 +13,20 @@ It is documentation-only. It does not change runtime behavior.
13
13
  Project sources:
14
14
 
15
15
  - `README.md`
16
- - `ObservMe-Production-Docs/01-requirements-and-scope.md`
17
- - `ObservMe-Production-Docs/02-reference-architecture.md`
18
- - `ObservMe-Production-Docs/03-pi-event-and-session-model.md`
19
- - `ObservMe-Production-Docs/04-telemetry-semantic-conventions.md`
20
- - `ObservMe-Production-Docs/06-security-privacy-redaction.md`
21
- - `ObservMe-Production-Docs/07-extension-implementation-blueprint.md`
22
- - `ObservMe-Production-Docs/09-dashboards-alerts-slos.md`
23
- - `ObservMe-Production-Docs/10-testing-release-operations.md`
24
- - `ObservMe-Production-Docs/12-configuration-reference.md`
16
+ - `docs/extension-integration.md`
17
+ - `docs/reference/01-requirements-and-scope.md`
18
+ - `docs/reference/02-reference-architecture.md`
19
+ - `docs/reference/03-pi-event-and-session-model.md`
20
+ - `docs/reference/04-telemetry-semantic-conventions.md`
21
+ - `docs/reference/06-security-privacy-redaction.md`
22
+ - `docs/reference/07-extension-implementation-blueprint.md`
23
+ - `docs/reference/09-dashboards-alerts-slos.md`
24
+ - `docs/reference/10-testing-release-operations.md`
25
+ - `docs/reference/12-configuration-reference.md`
26
+ - `src/integration.ts`
25
27
  - `src/pi/agent-lineage.ts`
26
28
  - `src/pi/agent-tree-tracker.ts`
29
+ - `src/pi/integration-api.ts`
27
30
  - `src/pi/subagent-spawn.ts`
28
31
  - `src/pi/handlers.ts`
29
32
  - `src/pi/handler-internals.ts`
@@ -41,6 +44,7 @@ Project sources:
41
44
  - `dashboards/observme-slos.yaml`
42
45
  - `examples/observme.yaml`
43
46
  - `examples/collector.yaml`
47
+ - `examples/integrations/subagent-runner.ts`
44
48
  - `test/agent-lineage.test.ts`
45
49
  - `test/subagent-spawn.test.mjs`
46
50
 
@@ -233,18 +237,16 @@ The required parent-side flow is:
233
237
  9. Parent records `pi.agent.join` when it receives the child result/status.
234
238
  10. Parent updates the in-memory agent tree and `/obs agents` runtime state.
235
239
 
236
- The existing helper module for this is `src/pi/subagent-spawn.ts`:
240
+ External extensions use the versioned API documented in [`extension-integration.md`](extension-integration.md):
237
241
 
238
- - `startSubagentSpawn(...)`
239
- - `completeSubagentSpawn(...)`
240
- - `failSubagentSpawn(...)`
241
- - `runSubagentWithObservability(...)`
242
- - `startAgentWait(...)` / `endAgentWait(...)`
243
- - `startAgentJoin(...)` / `endAgentJoin(...)`
244
- - `recordAgentWait(...)` / `recordAgentJoin(...)`
245
- - `observeTrustedSubagentLineage(...)`
242
+ - `requestObservMeIntegration(pi)`
243
+ - `startSubagent(...)`
244
+ - `completeSubagent(...)`
245
+ - `failSubagent(...)`
246
+ - `startWait(...)` / `endWait(...)`
247
+ - `startJoin(...)` / `endJoin(...)`
246
248
 
247
- If a subagent extension launches `pi` without using these helpers, ObservMe can still observe the launcher as a normal tool call, but the agent/subagent dashboards will not get the full spawn/depth/fan-out/wait/join contract.
249
+ The API delegates to ObservMe's internal `src/pi/subagent-spawn.ts` helpers without exposing the private telemetry session. If a subagent extension launches `pi` without this integration, ObservMe can still observe the launcher as a normal tool call, but the agent/subagent dashboards will not get the full spawn/depth/fan-out/wait/join contract.
248
250
 
249
251
  ### Tmux-specific spawn requirements
250
252
 
@@ -262,14 +264,7 @@ Required flow:
262
264
  8. Record `wait` while the orchestrator is waiting for child completion or a child status signal.
263
265
  9. Record `join` when the orchestrator collects a child result, sees a terminal child status, or times out.
264
266
 
265
- Conceptual command shape:
266
-
267
- ```text
268
- tmux new-session -d -s <safe-session-name> \
269
- 'env OBSERVME_WORKFLOW_ID=... OBSERVME_PARENT_AGENT_ID=... traceparent=... pi ...'
270
- ```
271
-
272
- The command above is illustrative only. The implementation must avoid logging the raw command because it contains environment values and user task text.
267
+ Prefer a dedicated tmux server/socket that is started with the returned process environment, or explicit tmux per-session environment facilities. Do not serialize the envelope into a shell command. The generic [`../examples/integrations/subagent-runner.ts`](../examples/integrations/subagent-runner.ts) adapter leaves this transport-specific environment handling to its `ChildTransport` implementation.
273
268
 
274
269
  ## 4. Environment propagation contract
275
270
 
@@ -821,20 +816,21 @@ The Pi example subagent extension:
821
816
  - collects child assistant messages, tool results, token usage, cost, and final output
822
817
  - supports Ctrl+C abort by killing child processes
823
818
 
824
- By default, the example spawn call does not pass ObservMe propagation env and does not call ObservMe's `startSubagentSpawn` / `completeSubagentSpawn` / `failSubagentSpawn` helpers.
819
+ By default, the example spawn call does not request ObservMe's integration API or pass its propagation environment.
825
820
 
826
821
  Therefore, to use that style of subagent and still populate ObservMe dashboards, an ObservMe-aware adapter must wrap the child process spawn and pass the returned env to the child process.
827
822
 
828
823
  Minimum adapter behavior:
829
824
 
830
- 1. Before spawning child Pi, call `startSubagentSpawn` with spawn type/reason and safe command metadata.
831
- 2. Pass `started.env` into `child_process.spawn`.
832
- 3. On child process close success, call `completeSubagentSpawn`.
833
- 4. On child process error/abort/failure, call `failSubagentSpawn` or complete with cancelled/failed status.
834
- 5. Around blocking waits, record `pi.agent.wait`.
835
- 6. When child output is collected, record `pi.agent.join` with child status.
836
- 7. Ensure the child command loads ObservMe as an extension/package.
837
- 8. Ensure the child ObservMe runtime accepts the propagated parent context as trusted.
825
+ 1. Request the API with `requestObservMeIntegration(pi)`.
826
+ 2. Before spawning child Pi, call `startSubagent` with spawn type/reason and safe command metadata.
827
+ 3. Pass the returned `env` into `child_process.spawn`.
828
+ 4. On launcher success, call `completeSubagent` with child status `active`.
829
+ 5. On launcher error/abort/failure, call `failSubagent` or complete with cancelled status.
830
+ 6. Around blocking waits, call `startWait` and `endWait`.
831
+ 7. When child output is collected, call `startJoin` and `endJoin` with child status.
832
+ 8. Ensure the child command loads ObservMe as an extension/package.
833
+ 9. Ensure the child ObservMe runtime receives the complete propagated parent context.
838
834
 
839
835
  Without that adapter, parent tool metrics may show a `subagent` tool call, but the agent-tree dashboard will not have reliable spawn/depth/fan-out/wait/join lineage.
840
836
 
@@ -946,7 +942,7 @@ These checkpoints reflect the current code and dashboards after source-review re
946
942
  - The production extension enables process-environment lineage eligibility while keeping trusted project `.env` outside the provenance boundary.
947
943
  - Valid W3C context explicitly parents the child `pi.session`; unavailable continuation uses a validated span link or bounded propagation-failure fallback.
948
944
  - Bounded agent-tree tracking exists in `src/pi/agent-tree-tracker.ts`.
949
- - Spawn/wait/join helper functions exist in `src/pi/subagent-spawn.ts`.
945
+ - Spawn/wait/join helper functions exist in `src/pi/subagent-spawn.ts` and are exposed to other loaded extensions through the versioned `@senad-d/observme/integration` event-bus API.
950
946
  - Spawn duration is recorded on completion and launcher failure. Child completion/join records child failure and confirmed parent recovery once through bounded deduplication state.
951
947
  - Session, agent-run/turn, LLM, tool/bash, and session metadata/tree handlers are split under `src/pi/event-handlers/` behind the stable `src/pi/handlers.ts` facade.
952
948
  - Root workflow duration is recorded at shutdown, and failed agent runs increment `observme_agent_run_errors_total`.
@@ -957,7 +953,7 @@ These checkpoints reflect the current code and dashboards after source-review re
957
953
  ### Remaining integration gaps before relying on full subagent dashboards
958
954
 
959
955
  1. **External and tmux subagent launchers are not automatically wrapped.**
960
- - `src/pi/subagent-spawn.ts` exposes helpers, but arbitrary extensions that call `child_process.spawn` or `tmux new-session` will not be detected automatically.
956
+ - The public integration API lets launchers record the lifecycle explicitly, but arbitrary extensions that call `child_process.spawn` or `tmux new-session` without it cannot be detected automatically.
961
957
  - The Pi example subagent extension currently spawns child Pi processes without ObservMe env propagation.
962
958
  - A future tmux orchestration extension must own this wrapping and lifecycle tracking.
963
959
 
@@ -1,5 +1,7 @@
1
1
  # ObservMe configuration
2
2
 
3
+ Use this guide for routine project setup. For every supported key and environment variable, see the [complete configuration reference](reference/12-configuration-reference.md). For the supported local profile, see the [example guide](../examples/README.md).
4
+
3
5
  ObservMe creates a project-local starter config automatically during trusted Pi session-start lifecycles.
4
6
 
5
7
  ## Automatic project config
@@ -36,3 +38,10 @@ defaults → global ~/.pi/agent/observme.yaml → trusted project .pi/observme.y
36
38
  Use `~/.pi/agent/observme.yaml` for standard-distribution global defaults that should apply across projects. Use `<CONFIG_DIR_NAME>/observme.yaml` for per-project setup. Because `.env` and system environment variables have higher precedence than YAML, remove or update stale `OBSERVME_REDACTION_ENABLED`, `OBSERVME_ALLOW_UNSAFE_CAPTURE`, and `OBSERVME_CAPTURE_*` overrides when YAML privacy settings appear to be ignored.
37
39
 
38
40
  Invalid or unsafe merged configuration falls back to safe defaults. `/obs status`, structured `config.rejected` telemetry, and Pi UI notifications when available report only bounded source and issue codes/counts; rejected values, paths, headers, regular expressions, and credentials are never rendered. Project `.env` remains a configuration layer only and cannot establish parent-agent lineage.
41
+
42
+ ## Related documentation
43
+
44
+ - [Documentation index](README.md)
45
+ - [Example configurations](../examples/README.md)
46
+ - [Security, privacy, and redaction](reference/06-security-privacy-redaction.md)
47
+ - [Grafana and `/obs` validation flow](validation-flow.md)