@senad-d/observme 0.1.1 → 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 (37) 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/package.json +11 -2
  20. package/skills/observme-docs/SKILL.md +65 -0
  21. package/src/integration.ts +134 -0
  22. package/src/pi/handlers.ts +11 -0
  23. package/src/pi/integration-api.ts +224 -0
  24. package/src/pi/subagent-spawn.ts +1 -1
  25. package/tsconfig.json +1 -1
  26. package/ObservMe-Production-Docs/00-README.md +0 -79
  27. /package/{ObservMe-Production-Docs → docs/reference}/01-requirements-and-scope.md +0 -0
  28. /package/{ObservMe-Production-Docs → docs/reference}/02-reference-architecture.md +0 -0
  29. /package/{ObservMe-Production-Docs → docs/reference}/03-pi-event-and-session-model.md +0 -0
  30. /package/{ObservMe-Production-Docs → docs/reference}/04-telemetry-semantic-conventions.md +0 -0
  31. /package/{ObservMe-Production-Docs → docs/reference}/06-security-privacy-redaction.md +0 -0
  32. /package/{ObservMe-Production-Docs → docs/reference}/08-query-grafana-integration.md +0 -0
  33. /package/{ObservMe-Production-Docs → docs/reference}/09-dashboards-alerts-slos.md +0 -0
  34. /package/{ObservMe-Production-Docs → docs/reference}/10-testing-release-operations.md +0 -0
  35. /package/{ObservMe-Production-Docs → docs/reference}/11-deployment-runbooks.md +0 -0
  36. /package/{ObservMe-Production-Docs → docs/reference}/12-configuration-reference.md +0 -0
  37. /package/{ObservMe-Production-Docs → docs/reference}/13-source-notes.md +0 -0
@@ -0,0 +1,222 @@
1
+ # Integrating other Pi extensions with ObservMe
2
+
3
+ Use this guide when another Pi extension launches or manages work that ObservMe cannot infer from Pi's standard lifecycle events. Orchestrators, subagent runners, process managers, remote executors, and workflow engines should use the versioned integration API instead of constructing ObservMe lineage variables themselves.
4
+
5
+ ## What ObservMe captures automatically
6
+
7
+ Every Pi process that loads ObservMe emits its own supported session, workflow, agent-run, turn, LLM, tool, Bash, branch, compaction, model, thinking, trace, metric, and log telemetry. No integration API is needed for those standard Pi events.
8
+
9
+ Cross-process orchestration adds information that Pi does not emit automatically:
10
+
11
+ - a parent decided to spawn a child;
12
+ - the child belongs to a specific workflow and parent/root lineage;
13
+ - W3C trace context should cross the process boundary;
14
+ - the parent waited for and joined the child;
15
+ - the launcher, child, or join failed, timed out, or recovered.
16
+
17
+ An orchestration extension must report those transitions and launch the child with the propagation environment returned by ObservMe.
18
+
19
+ ## Public integration surface
20
+
21
+ Import the API types and discovery helper from the package subpath:
22
+
23
+ ```typescript
24
+ import {
25
+ requestObservMeIntegration,
26
+ type ObservMeIntegrationApi,
27
+ } from "@senad-d/observme/integration";
28
+ ```
29
+
30
+ The helper uses Pi's shared `pi.events` bus and negotiates integration API version 1 synchronously:
31
+
32
+ ```typescript
33
+ const observme: ObservMeIntegrationApi | undefined = requestObservMeIntegration(pi);
34
+ ```
35
+
36
+ ObservMe registers no global object and does not require another extension to import its internal telemetry session. The event bus is the runtime boundary; the package subpath provides the stable constants, types, and request helper.
37
+
38
+ The API can be absent when ObservMe is not installed, disabled by package configuration, not loaded yet, or incompatible. A method returns `{ ok: false, reason: "session_unavailable" }` when ObservMe is loaded but no telemetry session is active. Orchestration must remain functional in both cases and may run the child without ObservMe correlation after reporting a bounded local warning.
39
+
40
+ A package that cannot take a runtime dependency can implement the same synchronous request directly. Keep this channel and version stable:
41
+
42
+ ```typescript
43
+ let observme: ObservMeIntegrationApi | undefined;
44
+ pi.events.emit("observme:integration:request", {
45
+ supportedVersions: [1],
46
+ respond(api: ObservMeIntegrationApi) {
47
+ observme ??= api;
48
+ },
49
+ });
50
+ ```
51
+
52
+ Request the API when the user/tool starts orchestration, not from the extension factory. If a `session_start` handler must launch work automatically, account for extension handler ordering and retry only after ObservMe has an active session.
53
+
54
+ ## Required parent lifecycle
55
+
56
+ Use this order for each child process:
57
+
58
+ 1. Request the ObservMe integration API.
59
+ 2. Call `startSubagent()` immediately before launching the child.
60
+ 3. Pass the returned `env` as the child process environment without logging it.
61
+ 4. Call `completeSubagent(..., { childStatus: "active" })` when the launcher successfully creates the child.
62
+ 5. Call `failSubagent()` when the launcher fails before the child is active.
63
+ 6. Call `startWait()`/`endWait()` around time spent waiting for child completion.
64
+ 7. Call `startJoin()`/`endJoin()` when collecting the terminal child status or result.
65
+
66
+ ```typescript
67
+ const observme = requestObservMeIntegration(pi);
68
+ const started = observme?.startSubagent({
69
+ command: "pi",
70
+ args: ["--mode", "rpc"],
71
+ spawnType: "extension",
72
+ spawnReason: "delegated_task",
73
+ env: process.env,
74
+ });
75
+
76
+ if (!started?.ok) {
77
+ // Continue fail-open without correlation, or notify the operator locally.
78
+ return;
79
+ }
80
+
81
+ try {
82
+ await launchChildPi({ env: started.env });
83
+ observme.completeSubagent(started.spawnId, {
84
+ childAgentId: started.childAgentId,
85
+ childStatus: "active",
86
+ });
87
+ } catch (error) {
88
+ observme.failSubagent(started.spawnId, {
89
+ childAgentId: started.childAgentId,
90
+ errorClass: error instanceof Error ? error.name : "launcher_error",
91
+ });
92
+ throw error;
93
+ }
94
+ ```
95
+
96
+ Do not put raw tasks, prompts, command lines, environment values, child output, or private paths in `errorClass`, `spawnReason`, or other bounded fields.
97
+
98
+ ## API methods
99
+
100
+ | Method | Use |
101
+ | --- | --- |
102
+ | `getContext()` | Read the current workflow, root/parent/current agent, role, depth, session, and trace identifiers for local orchestration correlation. These are high-cardinality values and must not become metric labels. |
103
+ | `startSubagent(options)` | Starts `pi.agent.spawn`, records spawn metrics/logs, creates bounded parent tree state, and returns a sanitized propagation environment. |
104
+ | `completeSubagent(spawnId, options)` | Ends a successful launcher operation. Use child status `active` when the child is running; use `completed` only when launch and child completion are intentionally represented together. |
105
+ | `failSubagent(spawnId, options)` | Ends a launcher failure and records bounded failure telemetry. |
106
+ | `startWait(options)` / `endWait(id, options)` | Measures time the parent is blocked on a child or dependency. |
107
+ | `startJoin(options)` / `endJoin(id, options)` | Measures result collection and records child failure propagation or confirmed parent recovery. |
108
+
109
+ `startSubagent()` accepts:
110
+
111
+ | Option | Values and meaning |
112
+ | --- | --- |
113
+ | `spawnId` | Optional caller-generated safe ID; omit to let ObservMe generate it. |
114
+ | `childAgentId` | Optional bounded parent-side placeholder; this is not propagated as the child's real agent ID. |
115
+ | `command` / `args` | Used only to create a salted command fingerprint when configured; raw values are not exported. Omit them if the launcher cannot safely provide them. |
116
+ | `spawnType` | `command`, `tool`, `extension`, or `unknown`. |
117
+ | `spawnReason` | `delegated_task`, `parallel_search`, `review`, `tool_wrapper`, or `unknown`. |
118
+ | `toolCallId` | Optional high-cardinality trace/log correlation when a tool initiated the spawn. |
119
+ | `env` | Base child environment. ObservMe removes stale lineage/W3C keys and returns the replacement environment. |
120
+
121
+ Completion and wait/join methods use bounded child states (`starting`, `active`, `completed`, `failed`, `cancelled`, `orphaned`), join states (`waiting`, `completed`, `failed`, `cancelled`, `timeout`, `unknown`), and wait reasons (`dependency`, `rate_limit`, `child_running`, `unknown`). `failurePropagated=false` on a completed join confirms that the parent recovered from a failed child.
122
+
123
+ All mutation methods return a discriminated result. Handle `session_unavailable`, `spawn_not_found`, `wait_not_found`, `join_not_found`, and `operation_failed` without crashing Pi. Do not retry a completed lifecycle handle blindly; repeated completion can otherwise hide an orchestration-state bug.
124
+
125
+ ## Propagation environment
126
+
127
+ `startSubagent()` clears stale ObservMe and W3C values from the supplied base environment and, when enabled, returns a complete current envelope. Default names are:
128
+
129
+ ```text
130
+ OBSERVME_WORKFLOW_ID
131
+ OBSERVME_PARENT_AGENT_ID
132
+ OBSERVME_ROOT_AGENT_ID
133
+ OBSERVME_PARENT_SESSION_ID
134
+ OBSERVME_PARENT_TRACE_ID
135
+ OBSERVME_PARENT_SPAN_ID
136
+ OBSERVME_AGENT_DEPTH
137
+ OBSERVME_SPAWN_ID
138
+ OBSERVME_AGENT_CAPABILITY
139
+ traceparent
140
+ tracestate
141
+ ```
142
+
143
+ Important rules:
144
+
145
+ - Pass the complete returned `env`; do not merge stale lineage values back afterward.
146
+ - Do not set `OBSERVME_AGENT_ID` for a child. The child creates its own logical agent ID.
147
+ - `OBSERVME_AGENT_DEPTH` carries the parent depth; the child increments it.
148
+ - The child accepts lineage only from its Pi process environment, not project `.env`.
149
+ - When trace propagation is enabled, `traceparent` is required and duplicate parent trace/span metadata must agree with it.
150
+ - Never log or persist the full environment.
151
+
152
+ Names can be changed in ObservMe configuration. This is another reason to use the returned environment rather than hardcoding defaults.
153
+
154
+ ## Child requirements
155
+
156
+ The child Pi process must:
157
+
158
+ 1. load a compatible ObservMe package;
159
+ 2. receive the returned environment unchanged;
160
+ 3. use the same or a compatible OTLP destination;
161
+ 4. run in a trusted project when project-local ObservMe configuration is required;
162
+ 5. avoid `--no-extensions` unless ObservMe is explicitly loaded again with `-e`.
163
+
164
+ A child that loads ObservMe without the envelope is still observable, but it appears as a separate root-like runtime. A malformed or partial envelope fails open and emits bounded orphan/propagation diagnostics.
165
+
166
+ The parent-side `childAgentId` is a bounded placeholder until the child's generated agent ID is reported through the orchestrator's own RPC, status-file, or result protocol. Use `spawnId`, workflow ID, and trace context as the initial cross-process correlation. Do not propagate the placeholder as `OBSERVME_AGENT_ID`.
167
+
168
+ ## Transport requirements
169
+
170
+ The integration API is transport-agnostic. A launcher can use a local subprocess, Pi RPC, JSON/print mode, tmux, SSH, a container runtime, a queue, or another process manager as long as it:
171
+
172
+ - passes the returned environment unchanged to the child Pi process;
173
+ - does not serialize the envelope or raw task into telemetry or captured logs;
174
+ - reports launcher completion/failure separately from child completion;
175
+ - records wait and join around the transport's actual blocking and result-collection boundaries;
176
+ - guarantees the child loads a compatible ObservMe extension;
177
+ - cleans up temporary files, pipes, sessions, containers, or remote resources deterministically.
178
+
179
+ Transport-specific environment behavior remains the launcher's responsibility. For example, a long-running tmux server can cache an old environment, an SSH command can expose arguments in logs, and a container runtime can require an explicit environment allowlist. Use the transport's secure environment mechanism instead of embedding the envelope in a shell command.
180
+
181
+ See [`../examples/integrations/subagent-runner.ts`](../examples/integrations/subagent-runner.ts) for a generic transport adapter and [`agent-subagent-observability-requirements.md`](agent-subagent-observability-requirements.md) for detailed orchestration considerations.
182
+
183
+ ## Telemetry produced by a complete integration
184
+
185
+ A complete parent/child flow can produce:
186
+
187
+ - spans: `pi.agent.spawn`, `pi.agent.wait`, `pi.agent.join`, and the child's normal `pi.session`/agent/turn/LLM/tool spans;
188
+ - metrics: spawn count/failure/duration, wait/join duration, active agents, depth, width, fan-out, orphan and propagation failures, child failures, and parent recovery;
189
+ - logs: `agent.spawn.*`, `agent.wait.*`, `agent.join.*`, `agent.orphaned`, and `trace_context.propagation_failed`.
190
+
191
+ Workflow, session, agent, spawn, trace, and span identifiers remain trace/log attributes only. Aggregate metric labels use bounded fields such as role, depth, spawn type/reason, status, reason, and error class.
192
+
193
+ ## Supported boundaries and non-goals
194
+
195
+ | Integration | Supported behavior |
196
+ | --- | --- |
197
+ | Direct child `pi` process | Full parent spawn/wait/join telemetry and child trace continuation when the child loads ObservMe and receives the returned environment. |
198
+ | Process-manager child Pi | Supported with explicit environment handling appropriate to the selected transport. |
199
+ | RPC, JSON, or print-mode child Pi | Supported; the orchestration transport determines task/result handling while ObservMe handles telemetry correlation. |
200
+ | Remote child Pi | Supported when the launcher transmits the envelope securely, the child loads ObservMe, and both sides export to compatible backends. Do not print the envelope into remote shell logs. |
201
+ | Non-Pi subprocess | Parent launcher telemetry can be recorded, but the subprocess does not emit Pi session/turn/LLM/tool telemetry unless it is itself instrumented. |
202
+ | Arbitrary custom metrics/logs/spans | Not exposed by this API. The API intentionally limits labels and event names to the ObservMe orchestration contract. Propose a versioned semantic addition instead of accepting arbitrary telemetry names or labels. |
203
+ | Orchestration control | Not provided. Task queues, process/session management, RPC, retries, concurrency, status transport, result storage, and cleanup remain the orchestrator's responsibility. |
204
+
205
+ ## Dependency and versioning guidance
206
+
207
+ The example imports `@senad-d/observme/integration` because it ships inside the same ObservMe package. A separately distributed Pi package has two choices:
208
+
209
+ 1. Add `@senad-d/observme` as a development/runtime dependency according to its packaging strategy so the helper and types resolve, while still requiring users to load ObservMe as a Pi extension.
210
+ 2. Avoid a runtime dependency by emitting the documented `observme:integration:request` event locally and using an `import type` during development. The runtime protocol is the shared Pi event channel, not shared module state.
211
+
212
+ Pi packages can have separate module roots. Do not assume that an independently installed ObservMe package is automatically resolvable as a Node module from another package, and do not load a bundled second ObservMe extension accidentally. Runtime negotiation determines whether one compatible ObservMe integration provider is actually loaded.
213
+
214
+ The current public integration version is `1`. Additive API changes can preserve version 1; incompatible behavior requires a new negotiated version.
215
+
216
+ ## Related documentation
217
+
218
+ - [Documentation index](README.md)
219
+ - [Agent and subagent orchestration requirements](agent-subagent-observability-requirements.md)
220
+ - [Pi event and session model](reference/03-pi-event-and-session-model.md)
221
+ - [Telemetry semantic conventions](reference/04-telemetry-semantic-conventions.md)
222
+ - [Configuration reference](reference/12-configuration-reference.md)
@@ -0,0 +1,81 @@
1
+ # ObservMe technical reference
2
+
3
+ This directory contains the detailed architecture, telemetry, privacy, operations, and implementation contracts for ObservMe. For installation or routine setup, start with [`../../README.md`](../../README.md) and the task-oriented [`../README.md`](../README.md) index instead.
4
+
5
+ ObservMe is a Pi extension that captures session, turn, tool, LLM, branch, compaction, and agent-lineage events, translates them into OpenTelemetry traces, metrics, and logs, and exports them to an external observability stack. It is not a local analytics database.
6
+
7
+ ## Choose a document
8
+
9
+ ### Product and architecture
10
+
11
+ | File | Use it for |
12
+ | --- | --- |
13
+ | [`01-requirements-and-scope.md`](01-requirements-and-scope.md) | Product goals, personas, hard requirements, non-goals, and success criteria. |
14
+ | [`02-reference-architecture.md`](02-reference-architecture.md) | Components, data flow, trace shape, deployment topologies, and failure boundaries. |
15
+ | [`03-pi-event-and-session-model.md`](03-pi-event-and-session-model.md) | Pi event mapping, session entries, branching, compaction, recovery, and agent lineage. |
16
+ | [`07-extension-implementation-blueprint.md`](07-extension-implementation-blueprint.md) | Extension modules, lifecycle, span registries, handlers, and implementation patterns. |
17
+ | [`pi-session-format.md`](pi-session-format.md) | Adapted Pi JSONL session reference used by ObservMe. |
18
+
19
+ ### Telemetry and data handling
20
+
21
+ | File | Use it for |
22
+ | --- | --- |
23
+ | [`04-telemetry-semantic-conventions.md`](04-telemetry-semantic-conventions.md) | Span names, attributes, metrics, labels, logs, and cardinality rules. |
24
+ | [`05-otel-pipeline-and-collector.md`](05-otel-pipeline-and-collector.md) | OTLP exporters, Collector pipelines, routing, sampling, and backend notes. |
25
+ | [`06-security-privacy-redaction.md`](06-security-privacy-redaction.md) | Capture defaults, data classification, redaction, hashing, TLS, and tenant isolation. |
26
+
27
+ ### Operation and configuration
28
+
29
+ | File | Use it for |
30
+ | --- | --- |
31
+ | [`08-query-grafana-integration.md`](08-query-grafana-integration.md) | `/obs` query behavior, Grafana access, safe queries, and trace links. |
32
+ | [`09-dashboards-alerts-slos.md`](09-dashboards-alerts-slos.md) | Dashboard map, variables, drill-downs, PromQL/LogQL, alerts, and SLOs. |
33
+ | [`10-testing-release-operations.md`](10-testing-release-operations.md) | Test levels, failure tests, performance, cardinality, releases, and support. |
34
+ | [`11-deployment-runbooks.md`](11-deployment-runbooks.md) | Local, Docker, CI, and production deployment checks plus common incidents. |
35
+ | [`12-configuration-reference.md`](12-configuration-reference.md) | Complete YAML schema, environment variables, precedence, defaults, and validation. |
36
+
37
+ ### Source basis
38
+
39
+ | File | Use it for |
40
+ | --- | --- |
41
+ | [`13-source-notes.md`](13-source-notes.md) | Pi, OpenTelemetry, and Grafana assumptions used by this reference set. |
42
+
43
+ ## Related task-oriented documentation
44
+
45
+ - [`../configuration.md`](../configuration.md) — quick project configuration.
46
+ - [`../extension-integration.md`](../extension-integration.md) — versioned integration API for orchestrators and other Pi extensions.
47
+ - [`../validation-flow.md`](../validation-flow.md) — secret-safe Grafana and `/obs` troubleshooting.
48
+ - [`../compatibility-matrix.md`](../compatibility-matrix.md) — currently tested versions.
49
+ - [`../../examples/README.md`](../../examples/README.md) — safe use of the shipped YAML examples.
50
+ - [`../../SECURITY.md`](../../SECURITY.md) — package trust and vulnerability reporting.
51
+
52
+ ## Core design
53
+
54
+ ```text
55
+ Pi Agent
56
+ └── ObservMe Pi Extension
57
+ ├── OTEL Traces ──► OTEL Collector ──► Tempo
58
+ ├── OTEL Metrics ──► OTEL Collector ──► Prometheus / Mimir
59
+ └── OTEL Logs ──► OTEL Collector ──► Loki
60
+
61
+ Grafana
62
+ ├── Tempo datasource
63
+ ├── Loki datasource
64
+ └── Prometheus/Mimir datasource
65
+ ```
66
+
67
+ ## Reference principles
68
+
69
+ 1. **OTLP-first.** ObservMe emits OpenTelemetry traces, metrics, and logs.
70
+ 2. **No durable local telemetry storage.** Only bounded in-memory queues are allowed.
71
+ 3. **Fail open.** Observability failure must not stop Pi.
72
+ 4. **Privacy by default.** Prompt, response, thinking, tool, Bash, and path capture starts disabled.
73
+ 5. **Pi-native and OTEL-compatible semantics.** ObservMe uses `observme.*`, `pi.*`, and applicable official `gen_ai.*` attributes.
74
+ 6. **Agent lineage by design.** Parent and child telemetry uses `pi.agent.*` lineage and W3C context where an ObservMe-aware launcher can propagate it.
75
+ 7. **Low-cardinality metrics.** Workflow, session, agent, trace, span, entry, and tool-call identifiers belong on traces and logs, not metric labels.
76
+ 8. **Collector recommended.** Direct-to-backend export is for development or constrained environments.
77
+ 9. **Backend-neutral.** Tempo, Loki, and Prometheus/Mimir are reference backends rather than hard runtime dependencies.
78
+
79
+ ## How to interpret this reference
80
+
81
+ Some documents define reserved or future-facing contracts in addition to currently emitted behavior. Use the telemetry catalog in [`../../README.md#available-telemetry`](../../README.md#available-telemetry) to distinguish live signals from names marked reserved or registered but not yet recorded. If a detailed reference conflicts with the current user guides, report the discrepancy and prefer the current user-facing behavior until the reference is corrected.
@@ -121,6 +121,11 @@ service:
121
121
  This configuration routes traces to Tempo, logs to Loki, and metrics to a Prometheus-compatible remote write endpoint such as Mimir. Use a Collector distribution that contains every configured component. The minimal debug example works with the core Collector, while `prometheusremotewrite`, `probabilistic_sampler`, and `tail_sampling` are commonly deployed from the Collector Contrib distribution or a vendor distribution such as Grafana Alloy.
122
122
 
123
123
  ```yaml
124
+ # Production-oriented Collector reference for Tempo, Loki, and Mimir.
125
+ # Verify that your Collector distribution contains every configured component,
126
+ # replace backend endpoints/security for your deployment, and never add raw
127
+ # content or high-cardinality execution identifiers to metric labels.
128
+ # Guide: examples/README.md; design: docs/reference/05-otel-pipeline-and-collector.md.
124
129
  extensions:
125
130
  health_check:
126
131
  endpoint: 0.0.0.0:13133
@@ -424,7 +424,15 @@ Rules:
424
424
  - Rate limit export
425
425
  - Confirm with user before sending historical content
426
426
 
427
- ## 13. Versioning
427
+ ## 13. Inter-extension integration
428
+
429
+ Other Pi extensions must not import ObservMe's private telemetry session or `src/pi/subagent-spawn.ts` directly. ObservMe exposes a versioned request/response API through Pi's shared `pi.events` bus and the `@senad-d/observme/integration` package export.
430
+
431
+ The public API covers current context plus subagent spawn, launcher completion/failure, wait, and join transitions. `startSubagent()` returns the sanitized process environment that the launcher passes to the child. Runtime negotiation lets an orchestrator remain optional when ObservMe is absent or inactive.
432
+
433
+ See [`../extension-integration.md`](../extension-integration.md) for the public contract and [`../../examples/integrations/subagent-runner.ts`](../../examples/integrations/subagent-runner.ts) for a transport-agnostic consumer example.
434
+
435
+ ## 14. Versioning
428
436
 
429
437
  Extension versioning:
430
438
 
@@ -432,16 +440,19 @@ Extension versioning:
432
440
  MAJOR.MINOR.PATCH
433
441
  ```
434
442
 
435
- Breaking semconv changes require MAJOR.
443
+ Breaking semantic-convention changes require MAJOR. Incompatible inter-extension API changes require a newly negotiated integration API version.
436
444
 
437
- ## 14. Build Artifact
445
+ ## 15. Package surface
438
446
 
439
- Recommended output:
447
+ The published Pi package includes:
440
448
 
441
449
  ```text
442
- dist/observme.js
443
- dist/observme.d.ts
450
+ src/extension.ts # Pi extension entry
451
+ src/integration.ts # public inter-extension types and discovery helper
452
+ skills/observme-docs/SKILL.md # progressive documentation routing
453
+ docs/extension-integration.md # integration contract
454
+ examples/integrations/subagent-runner.ts
444
455
  examples/observme.yaml
445
456
  examples/collector.yaml
446
- dashboards/*.json
457
+ dashboards/*
447
458
  ```
@@ -424,4 +424,4 @@ Key methods for working with sessions programmatically.
424
424
  - `getSessionDir()` - Session storage directory
425
425
  - `getSessionId()` - Session UUID
426
426
  - `getSessionFile()` - Session file path (undefined for in-memory)
427
- - `isPersisted()` - Whether session is saved to disk
427
+ - `isPersisted()` - Whether session is saved to disk
@@ -53,7 +53,7 @@ Use this checklist when a review, release candidate, or local operator needs cov
53
53
  | `npm run smoke:handlers` | Yes | Dependencies installed. | None. Uses the local Pi API harness. | No tracked writes. | Registers the extension and executes one command plus the first agent-facing tool when present. |
54
54
  | `npm run smoke:pi-lifecycle` | Yes | Dependencies installed. | None. Uses explicit loopback-only, telemetry-disabled config. | No tracked writes. | Registers `session_start`/`session_shutdown` and confirms lifecycle status cleanup without Collector, Grafana, or credentials. |
55
55
  | `npm run smoke:pi-runtime` | Yes when the `pi` CLI is installed in the test image | A working local `pi` executable, dependencies installed, and permission to spawn a local child process. | No credentials. It deletes inherited `OBSERVME_*` values and uses a deterministic loopback backend. | Creates a temporary project and extension files under the OS temp directory, then removes them; local loopback server only. | Real Pi RPC extension load, `/obs` discovery/routing, reload/new-session replacement, and credential-free event-shape smoke coverage. |
56
- | `npm run smoke:packaged` | Usually release/local only | `npm` available and package dependencies resolvable for a temporary install. | May need npm registry/cache access to install package dependencies; no project credentials. | Runs `npm pack`, creates a temporary project under the OS temp directory, installs the tarball with `--ignore-scripts --no-audit --no-fund --package-lock=false`, and removes the temp directory. | Packaged install layout and declared Pi extension files in the installed package. |
56
+ | `npm run smoke:packaged` | Usually release/local only | `npm` available and package dependencies resolvable for a temporary install. | May need npm registry/cache access to install package dependencies; no project credentials. | Runs `npm pack`, creates a temporary project under the OS temp directory, installs the tarball with `--ignore-scripts --no-audit --no-fund --package-lock=false`, and removes the temp directory. | Packaged install layout plus declared Pi extension and skill resources in the installed package. |
57
57
  | `npm run test:integration:collector` | No | Docker daemon available; Collector image `OBSERVME_COLLECTOR_IMAGE` or `otel/opentelemetry-collector-contrib:0.104.0` pullable or cached. | Docker image pull may require network; no Grafana/model credentials. | Starts a temporary Collector container with loopback-published ports and stops it in test cleanup. | OTLP export to Collector debug pipeline for representative traces, metrics, and logs. |
58
58
  | `npm run test:integration:grafana-stack` | No | Docker Compose available; `observability-stack/docker-compose.yml` and test overlay available; required Grafana/Tempo/Loki/Prometheus images pullable or cached. | Docker image pull may require network; no external Grafana credentials. Test-created local Grafana admin secret is synthetic. | Creates isolated Docker Compose project/networks/containers. May create `observability-stack/secrets/grafana_admin_password` when missing and removes the test-created file during cleanup; also creates temporary command-project files under the OS temp directory. If interrupted, run `docker compose` with the printed project name or remove stale `observme-grafana-it-*` resources. | Live local stack ingestion, datasource queries, `/obs` query commands, and dashboard provisioning imports. |
59
59
  | `npm run validate:grafana-obs` | No | Running Pi session with ObservMe loaded, reachable Collector/Grafana stack, and recent telemetry. See `docs/validation-flow.md`. | Requires Grafana read credentials from environment variables (`OBSERVME_GRAFANA_TOKEN` or username/password), datasource UIDs, and `OBSERVME_VALIDATION_SESSION_ID`; may access the configured Grafana URL. | Read-only against the configured stack; no file writes expected. Keep terminal output sanitized and omit secrets. | Operator-facing validation that Grafana has ObservMe data and representative `/obs` commands work against the same stack. |
@@ -1,6 +1,6 @@
1
1
  # ObservMe Grafana + `/obs` validation flow
2
2
 
3
- Use this secret-safe flow when Grafana shows ObservMe data but `/obs` commands appear broken. It classifies the failure as ingestion, labels, Grafana auth/query access, local TLS/DNS, Pi command registration, or session state.
3
+ Use this secret-safe flow when Grafana shows ObservMe data but `/obs` commands appear broken. It classifies the failure as ingestion, labels, Grafana auth/query access, local TLS/DNS, Pi command registration, or session state. For first-time setup, read the [configuration guide](configuration.md) and [example guide](../examples/README.md) first.
4
4
 
5
5
  ## Preconditions
6
6
 
@@ -115,3 +115,10 @@ node --test test/dashboards.test.mjs test/exporter-failure.test.ts test/chaos-fa
115
115
  | `/obs command path` | Pi command state, session state, or command query mismatch | Re-run the Pi commands in step 1; then run `npm run smoke:pi-runtime` to isolate real Pi command registration. |
116
116
 
117
117
  Release validation should not be considered complete while any step fails.
118
+
119
+ ## Related documentation
120
+
121
+ - [Documentation index](README.md)
122
+ - [Query and Grafana integration](reference/08-query-grafana-integration.md)
123
+ - [Deployment runbooks and common incidents](reference/11-deployment-runbooks.md)
124
+ - [Dashboards, alerts, and SLOs](reference/09-dashboards-alerts-slos.md)
@@ -0,0 +1,52 @@
1
+ # ObservMe examples
2
+
3
+ The npm package ships configuration examples and an extension-integration example. They are starting points, not credential stores or a complete orchestration product. Copy only what you need, review every endpoint and lifecycle transition, and keep tokens, passwords, and hash salts in environment variables or a trusted project `.env` file.
4
+
5
+ ## `observme.yaml`
6
+
7
+ [`observme.yaml`](observme.yaml) is a privacy-preserving local-development profile for the repository's supported Grafana stack:
8
+
9
+ - OTLP/HTTP exports to `http://localhost:4318`.
10
+ - Grafana queries use `https://observability.local`.
11
+ - Local self-signed TLS and IPv4 preference are enabled for that profile.
12
+ - Prompt, response, thinking, tool, Bash, and path capture remain disabled.
13
+ - Redaction remains enabled and unsafe capture remains disabled.
14
+
15
+ To use it in a trusted project:
16
+
17
+ 1. Copy it to `<project>/<CONFIG_DIR_NAME>/observme.yaml` (normally `.pi/observme.yaml`).
18
+ 2. Set Grafana and OTLP credentials through environment variables or a trusted project `.env`.
19
+ 3. Restart Pi so the session-scoped configuration is reloaded.
20
+ 4. Run `/obs status` and `/obs health`.
21
+
22
+ Read [`../docs/configuration.md`](../docs/configuration.md) for the quick guide and [`../docs/reference/12-configuration-reference.md`](../docs/reference/12-configuration-reference.md) for every setting.
23
+
24
+ ## `collector.yaml`
25
+
26
+ [`collector.yaml`](collector.yaml) is a production-oriented Collector reference for a Grafana stack:
27
+
28
+ - traces are exported to Tempo;
29
+ - logs are exported to Loki;
30
+ - metrics are remote-written to Mimir;
31
+ - high-cardinality workflow, agent, session, and spawn attributes are removed from metrics;
32
+ - accidental content attributes are removed from logs as defense in depth.
33
+
34
+ The example uses Collector components commonly provided by the Collector Contrib distribution. Verify that your deployed distribution includes every receiver, processor, and exporter, then replace backend endpoints and security settings for your environment.
35
+
36
+ Read [`../docs/reference/05-otel-pipeline-and-collector.md`](../docs/reference/05-otel-pipeline-and-collector.md) for pipeline design and [`../docs/reference/11-deployment-runbooks.md`](../docs/reference/11-deployment-runbooks.md) for deployment and incident checks.
37
+
38
+ ## `integrations/subagent-runner.ts`
39
+
40
+ [`integrations/subagent-runner.ts`](integrations/subagent-runner.ts) demonstrates how another Pi extension can wrap any child transport with ObservMe's versioned integration API. The transport interface can represent a local subprocess, Pi RPC, tmux, SSH, a container, a queue, or another process manager.
41
+
42
+ The generic adapter records spawn, launcher success/failure, wait, join, cancellation, timeout, and failure propagation while passing the returned environment to the transport unchanged. It does not prescribe task delivery, process management, result encoding, concurrency, retries, durable state, or child-ID handshake.
43
+
44
+ Read [`../docs/extension-integration.md`](../docs/extension-integration.md) before adapting it and [`../docs/agent-subagent-observability-requirements.md`](../docs/agent-subagent-observability-requirements.md) for the complete orchestration contract.
45
+
46
+ ## Safety notes
47
+
48
+ - Do not place real secrets directly in either YAML file.
49
+ - Keep content capture disabled unless there is an explicit, reviewed need.
50
+ - Keep redaction enabled for captured content and configure `OBSERVME_HASH_SALT`.
51
+ - Do not promote session, workflow, agent, trace, span, entry, or tool-call IDs to Prometheus labels.
52
+ - Use insecure transport or certificate verification bypass only for controlled local development.
@@ -1,3 +1,8 @@
1
+ # Production-oriented Collector reference for Tempo, Loki, and Mimir.
2
+ # Verify that your Collector distribution contains every configured component,
3
+ # replace backend endpoints/security for your deployment, and never add raw
4
+ # content or high-cardinality execution identifiers to metric labels.
5
+ # Guide: examples/README.md; design: docs/reference/05-otel-pipeline-and-collector.md.
1
6
  extensions:
2
7
  health_check:
3
8
  endpoint: 0.0.0.0:13133