@senad-d/observme 0.1.0

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 (111) hide show
  1. package/.env.example +57 -0
  2. package/CHANGELOG.md +52 -0
  3. package/LICENSE +21 -0
  4. package/ObservMe-Production-Docs/00-README.md +79 -0
  5. package/ObservMe-Production-Docs/01-requirements-and-scope.md +207 -0
  6. package/ObservMe-Production-Docs/02-reference-architecture.md +306 -0
  7. package/ObservMe-Production-Docs/03-pi-event-and-session-model.md +266 -0
  8. package/ObservMe-Production-Docs/04-telemetry-semantic-conventions.md +722 -0
  9. package/ObservMe-Production-Docs/05-otel-pipeline-and-collector.md +355 -0
  10. package/ObservMe-Production-Docs/06-security-privacy-redaction.md +294 -0
  11. package/ObservMe-Production-Docs/07-extension-implementation-blueprint.md +447 -0
  12. package/ObservMe-Production-Docs/08-query-grafana-integration.md +276 -0
  13. package/ObservMe-Production-Docs/09-dashboards-alerts-slos.md +640 -0
  14. package/ObservMe-Production-Docs/10-testing-release-operations.md +319 -0
  15. package/ObservMe-Production-Docs/11-deployment-runbooks.md +203 -0
  16. package/ObservMe-Production-Docs/12-configuration-reference.md +337 -0
  17. package/ObservMe-Production-Docs/13-source-notes.md +33 -0
  18. package/ObservMe-Production-Docs/pi-session-format.md +427 -0
  19. package/README.md +356 -0
  20. package/SECURITY.md +45 -0
  21. package/dashboards/observme-agent-node-graphs.json +250 -0
  22. package/dashboards/observme-agents.json +1880 -0
  23. package/dashboards/observme-alerts.yaml +113 -0
  24. package/dashboards/observme-branches-compactions.json +1042 -0
  25. package/dashboards/observme-cost.json +1254 -0
  26. package/dashboards/observme-errors.json +1659 -0
  27. package/dashboards/observme-export-health.json +1802 -0
  28. package/dashboards/observme-latency.json +1494 -0
  29. package/dashboards/observme-llm-conversations.json +730 -0
  30. package/dashboards/observme-logs-llm.json +644 -0
  31. package/dashboards/observme-models.json +933 -0
  32. package/dashboards/observme-overview.json +2129 -0
  33. package/dashboards/observme-slo-health.json +737 -0
  34. package/dashboards/observme-slos.yaml +56 -0
  35. package/dashboards/observme-tools.json +902 -0
  36. package/dashboards/observme-trace-journey.json +1793 -0
  37. package/docs/STRUCTURE.md +49 -0
  38. package/docs/agent-subagent-observability-requirements.md +997 -0
  39. package/docs/compatibility-matrix.md +39 -0
  40. package/docs/configuration-tui-design-standard.md +767 -0
  41. package/docs/configuration.md +38 -0
  42. package/docs/review-validation.md +115 -0
  43. package/docs/validation-flow.md +117 -0
  44. package/examples/collector.yaml +123 -0
  45. package/examples/observme.yaml +131 -0
  46. package/img/demo.gif +0 -0
  47. package/img/icon.svg +47 -0
  48. package/package.json +103 -0
  49. package/src/commands/obs-agents-runtime.ts +150 -0
  50. package/src/commands/obs-agents.ts +491 -0
  51. package/src/commands/obs-args.ts +63 -0
  52. package/src/commands/obs-backfill.ts +1334 -0
  53. package/src/commands/obs-command-support.ts +43 -0
  54. package/src/commands/obs-cost.ts +228 -0
  55. package/src/commands/obs-diagnostics.ts +22 -0
  56. package/src/commands/obs-errors.ts +156 -0
  57. package/src/commands/obs-health.ts +301 -0
  58. package/src/commands/obs-link.ts +90 -0
  59. package/src/commands/obs-logs.ts +194 -0
  60. package/src/commands/obs-loki-summary.ts +184 -0
  61. package/src/commands/obs-session.ts +259 -0
  62. package/src/commands/obs-status.ts +359 -0
  63. package/src/commands/obs-tools.ts +274 -0
  64. package/src/commands/obs-trace.ts +411 -0
  65. package/src/commands/obs.ts +211 -0
  66. package/src/config/bootstrap-project-config.ts +300 -0
  67. package/src/config/defaults.ts +143 -0
  68. package/src/config/load-config.ts +631 -0
  69. package/src/config/project-paths.ts +61 -0
  70. package/src/config/schema.ts +405 -0
  71. package/src/config/validate.ts +456 -0
  72. package/src/constants.ts +4 -0
  73. package/src/diagnostics/sanitize.ts +6 -0
  74. package/src/extension.ts +38 -0
  75. package/src/otel/logs.ts +160 -0
  76. package/src/otel/metrics.ts +165 -0
  77. package/src/otel/otlp-endpoint.ts +10 -0
  78. package/src/otel/sdk.ts +114 -0
  79. package/src/otel/shutdown.ts +102 -0
  80. package/src/otel/traces.ts +166 -0
  81. package/src/pi/agent-lineage.ts +378 -0
  82. package/src/pi/agent-tree-tracker.ts +258 -0
  83. package/src/pi/event-handlers/agent-turn.ts +155 -0
  84. package/src/pi/event-handlers/lifecycle.ts +642 -0
  85. package/src/pi/event-handlers/llm.ts +115 -0
  86. package/src/pi/event-handlers/session-events.ts +159 -0
  87. package/src/pi/event-handlers/tool-bash.ts +275 -0
  88. package/src/pi/handler-internals.ts +2154 -0
  89. package/src/pi/handler-runtime.ts +633 -0
  90. package/src/pi/handler-types.ts +261 -0
  91. package/src/pi/handlers.ts +75 -0
  92. package/src/pi/subagent-spawn.ts +975 -0
  93. package/src/pi/subagent-types.ts +29 -0
  94. package/src/privacy/content-capture.ts +104 -0
  95. package/src/privacy/hash.ts +93 -0
  96. package/src/privacy/redact.ts +619 -0
  97. package/src/privacy/secret-patterns.ts +185 -0
  98. package/src/privacy/truncate.ts +69 -0
  99. package/src/query/grafana-readiness.ts +164 -0
  100. package/src/query/grafana-transport.ts +481 -0
  101. package/src/query/grafana.ts +371 -0
  102. package/src/query/loki.ts +332 -0
  103. package/src/query/prometheus.ts +388 -0
  104. package/src/query/tempo.ts +332 -0
  105. package/src/safety/sensitive-input.ts +208 -0
  106. package/src/semconv/attributes.ts +279 -0
  107. package/src/semconv/metrics.ts +146 -0
  108. package/src/semconv/spans.ts +19 -0
  109. package/src/semconv/values.ts +13 -0
  110. package/src/util/bounded-map.ts +97 -0
  111. package/tsconfig.json +15 -0
@@ -0,0 +1,337 @@
1
+ # ObservMe Configuration Reference
2
+
3
+ ## 1. Full Example
4
+
5
+ ```yaml
6
+ observme:
7
+ enabled: true
8
+ environment: production
9
+ tenant: platform
10
+
11
+ otlp:
12
+ endpoint: https://otel-collector.example.com:4318 # base OTLP HTTP endpoint
13
+ protocol: http/protobuf
14
+ timeoutMs: 3000
15
+ headers:
16
+ Authorization: "Bearer ${OBSERVME_OTLP_TOKEN}"
17
+ tls:
18
+ enabled: true
19
+ insecureSkipVerify: false
20
+ # Derived SDK URLs for OTLP/HTTP exporters:
21
+ # traces: https://otel-collector.example.com:4318/v1/traces
22
+ # metrics: https://otel-collector.example.com:4318/v1/metrics
23
+ # logs: https://otel-collector.example.com:4318/v1/logs
24
+
25
+ resource:
26
+ attributes:
27
+ service.name: observme-pi-extension
28
+ observme.tenant.id: platform
29
+ pi.project.name: my-project
30
+ deployment.environment.name: production
31
+
32
+ workflow:
33
+ idEnv: OBSERVME_WORKFLOW_ID
34
+ enabled: true
35
+ maxDepthWarning: 5
36
+ maxFanoutWarning: 20
37
+
38
+ agent:
39
+ # Generated when absent. Parent/root values are accepted only from trusted
40
+ # process environment or explicit runtime options.
41
+ idEnv: OBSERVME_AGENT_ID
42
+ parentIdEnv: OBSERVME_PARENT_AGENT_ID
43
+ rootIdEnv: OBSERVME_ROOT_AGENT_ID
44
+ parentSessionIdEnv: OBSERVME_PARENT_SESSION_ID
45
+ parentTraceIdEnv: OBSERVME_PARENT_TRACE_ID
46
+ parentSpanIdEnv: OBSERVME_PARENT_SPAN_ID
47
+ depthEnv: OBSERVME_AGENT_DEPTH
48
+ spawnIdEnv: OBSERVME_SPAWN_ID
49
+ propagateTraceContext: true
50
+ propagateToSubagents: true
51
+ capabilityEnv: OBSERVME_AGENT_CAPABILITY
52
+ writeCorrelationEntry: false
53
+
54
+ traces:
55
+ enabled: true
56
+ sampleRatio: 1.0
57
+ batch:
58
+ maxQueueSize: 2048
59
+ maxExportBatchSize: 512
60
+ scheduledDelayMillis: 1000
61
+ exportTimeoutMillis: 3000
62
+
63
+ metrics:
64
+ enabled: true
65
+ exportIntervalMillis: 15000
66
+ exportTimeoutMillis: 3000
67
+
68
+ logs:
69
+ enabled: true
70
+ batch:
71
+ maxQueueSize: 2048
72
+ maxExportBatchSize: 512
73
+ scheduledDelayMillis: 1000
74
+
75
+ capture:
76
+ prompts: false
77
+ responses: false
78
+ thinking: false
79
+ toolArguments: false
80
+ toolResults: false
81
+ bashCommands: false
82
+ bashOutput: false
83
+ filePaths: false
84
+
85
+ privacy:
86
+ redactionEnabled: true
87
+ allowUnsafeCapture: false
88
+ allowInsecureTransport: false
89
+ tenantSaltEnv: OBSERVME_HASH_SALT
90
+ pathMode: hash
91
+ customRedactionPatterns:
92
+ - name: internal-token
93
+ pattern: "(?i)internal_token=[a-z0-9-]+"
94
+
95
+ limits:
96
+ maxPromptChars: 12000
97
+ maxResponseChars: 12000
98
+ maxToolArgumentChars: 8000
99
+ maxToolResultChars: 16000
100
+ maxBashOutputChars: 16000
101
+ maxLogBodyChars: 32000
102
+ maxActiveAgentRuns: 16
103
+ maxActiveTurns: 128
104
+ maxActiveToolCalls: 1024
105
+ maxActiveLlmRequests: 128
106
+ maxActiveSubagentSpawns: 128
107
+ maxActiveAgentWaits: 128
108
+ maxActiveAgentJoins: 128
109
+
110
+ query:
111
+ enabled: true
112
+ timeoutMs: 5000
113
+ maxLogs: 50
114
+ maxTraces: 20
115
+ maxMetricSeries: 20
116
+ maxAgents: 20
117
+ links:
118
+ traceUrlTemplate: "https://grafana.example.com/explore?left=..."
119
+ grafana:
120
+ url: https://grafana.example.com
121
+ token: ${OBSERVME_GRAFANA_TOKEN}
122
+ username: ""
123
+ password: ""
124
+ datasourceUids:
125
+ tempo: tempo
126
+ loki: loki
127
+ prometheus: mimir
128
+ tls:
129
+ insecureSkipVerify: false
130
+ transport:
131
+ preferIPv4: false
132
+
133
+ shutdown:
134
+ flushTimeoutMs: 3000
135
+ ```
136
+
137
+ ## 2. Environment Variables
138
+
139
+ ```text
140
+ OBSERVME_ENABLED
141
+ OBSERVME_ENVIRONMENT
142
+ OBSERVME_TENANT
143
+ OBSERVME_OTLP_ENDPOINT
144
+ OBSERVME_OTLP_PROTOCOL
145
+ OBSERVME_OTLP_TRACES_ENDPOINT
146
+ OBSERVME_OTLP_METRICS_ENDPOINT
147
+ OBSERVME_OTLP_LOGS_ENDPOINT
148
+ OBSERVME_OTLP_TOKEN
149
+ OBSERVME_WORKFLOW_ID
150
+ OBSERVME_WORKFLOW_MAX_DEPTH_WARNING
151
+ OBSERVME_WORKFLOW_MAX_FANOUT_WARNING
152
+ OBSERVME_AGENT_ID
153
+ OBSERVME_PARENT_AGENT_ID
154
+ OBSERVME_ROOT_AGENT_ID
155
+ OBSERVME_PARENT_SESSION_ID
156
+ OBSERVME_PARENT_TRACE_ID
157
+ OBSERVME_PARENT_SPAN_ID
158
+ OBSERVME_AGENT_DEPTH
159
+ OBSERVME_SPAWN_ID
160
+ OBSERVME_AGENT_CAPABILITY
161
+ OBSERVME_PROPAGATE_TRACE_CONTEXT
162
+ OBSERVME_PROPAGATE_TO_SUBAGENTS
163
+ OBSERVME_WRITE_CORRELATION_ENTRY
164
+ OBSERVME_GRAFANA_URL
165
+ OBSERVME_GRAFANA_TOKEN
166
+ OBSERVME_GRAFANA_USERNAME
167
+ OBSERVME_GRAFANA_PASSWORD
168
+ OBSERVME_GRAFANA_TEMPO_DATASOURCE_UID
169
+ OBSERVME_GRAFANA_LOKI_DATASOURCE_UID
170
+ OBSERVME_GRAFANA_PROMETHEUS_DATASOURCE_UID
171
+ OBSERVME_GRAFANA_TLS_INSECURE_SKIP_VERIFY
172
+ OBSERVME_GRAFANA_PREFER_IPV4
173
+ OBSERVME_HASH_SALT
174
+ OBSERVME_CAPTURE_PROMPTS
175
+ OBSERVME_CAPTURE_RESPONSES
176
+ OBSERVME_CAPTURE_TOOL_ARGUMENTS
177
+ OBSERVME_CAPTURE_TOOL_RESULTS
178
+ OBSERVME_CAPTURE_THINKING
179
+ OBSERVME_CAPTURE_BASH_COMMANDS
180
+ OBSERVME_CAPTURE_BASH_OUTPUT
181
+ OBSERVME_CAPTURE_FILE_PATHS
182
+ OBSERVME_REDACTION_ENABLED
183
+ OBSERVME_ALLOW_UNSAFE_CAPTURE
184
+ OBSERVME_ALLOW_INSECURE_TRANSPORT
185
+ ```
186
+
187
+ ## 3. Workflow and Agent Lineage Configuration
188
+
189
+ The `workflow:` and `agent:` config blocks control generated workflow identity, generated agent identity, and parent/child propagation. `pi.workflow.id`, `pi.agent.id`, `pi.agent.parent_id`, and related values are high-cardinality identifiers for traces/logs only; they must not be metric labels by default.
190
+
191
+ Rules:
192
+
193
+ - Generate a random `pi.agent.id` and `pi.workflow.id` when no trusted value is supplied.
194
+ - For root agents, set `pi.agent.root_id = pi.agent.id`, `pi.workflow.root_agent_id = pi.agent.id`, and `pi.agent.depth = 0`.
195
+ - For subagents, accept parent/root/depth values only from the Pi process environment supplied by a trusted ObservMe-aware launcher or from explicit runtime overrides. Project-local `.env` values may configure ObservMe but must not establish lineage provenance.
196
+ - Require a complete validated workflow, parent agent, root agent, depth, and spawn envelope. When `propagateTraceContext` is true, also require a valid W3C `traceparent`; validate optional `tracestate` and require duplicate parent trace/span metadata to match it.
197
+ - Reject partial, malformed, oversized, or stale propagation fail-open: generate root/orphan identity, emit only bounded sanitized failure telemetry, and never include rejected raw environment values.
198
+ - Continue a valid W3C parent context explicitly on the child `pi.session` span. If trusted lineage has no usable continuation, start a new trace and add a validated parent span link when metadata exists, otherwise emit the documented propagation-failure log/counter fallback.
199
+ - When `propagateTraceContext` is true, propagate W3C `traceparent`/`tracestate` to child processes launched by ObservMe-aware subagent wrappers.
200
+ - When `workflow.enabled` is true, propagate `OBSERVME_WORKFLOW_ID` to child processes and report depth/fan-out/orphan metrics.
201
+ - `writeCorrelationEntry` may append a minimal `custom` session entry for recovery, but it must remain disabled by default and must never use `custom_message`.
202
+
203
+ ## 4. Config Precedence
204
+
205
+ 1. Defaults
206
+ 2. Global config (`~/.pi/agent/observme.yaml`)
207
+ 3. Project config (`<cwd>/<CONFIG_DIR_NAME>/observme.yaml`, normally `.pi/observme.yaml`) only when `ctx.isProjectTrusted()` is true
208
+ 4. Project env file (`<cwd>/.env`) only when `ctx.isProjectTrusted()` is true
209
+ 5. System environment variables
210
+ 6. Explicit runtime options
211
+
212
+ Copy `.env.example` to `.env` for project-local extension variables, or export the same `OBSERVME_*` names in the shell before starting Pi. System environment variables override `.env` values, and `.env` must never be committed. If redacted content capture is enabled, set `OBSERVME_HASH_SALT` in the shell or trusted project `.env`; missing salts make capture fail closed.
213
+
214
+ Automatic project starter file:
215
+
216
+ - On `session_start`, the extension creates `<cwd>/<CONFIG_DIR_NAME>/observme.yaml` (`<cwd>/.pi/observme.yaml` in the standard distribution) when the project is trusted and the file is missing.
217
+ - The target is resolved as an absolute contained project path before mutation. The complete existence-check/create/write window uses Pi's per-file mutation queue, so concurrent starts create at most one starter.
218
+ - Existing project config is never overwritten.
219
+ - Edit the resolved project `observme.yaml` for custom setup: `otlp.endpoint` / signal-specific endpoints for the Collector, `resource.attributes` for service/project/tenant/environment labels, `capture` and `privacy` for content capture and redaction, and `query.grafana` / `query.links.traceUrlTemplate` for `/obs` query commands.
220
+ - The generated starter mirrors the privacy-preserving local profile; raw content capture is disabled, redaction is enabled, and unsafe capture is disabled.
221
+ - Keep credentials out of YAML. Reference environment variables in YAML and set secrets through the shell or a trusted project `.env`.
222
+ - Use `~/.pi/agent/observme.yaml` only for standard-distribution global defaults that should apply across projects; project `<CONFIG_DIR_NAME>/observme.yaml` overrides it after trust.
223
+
224
+ ## 5. Safe Production Defaults
225
+
226
+ ```yaml
227
+ capture:
228
+ prompts: false
229
+ responses: false
230
+ thinking: false
231
+ toolArguments: false
232
+ toolResults: false
233
+ bashCommands: false
234
+ bashOutput: false
235
+ filePaths: false
236
+ privacy:
237
+ redactionEnabled: true
238
+ allowUnsafeCapture: false
239
+ allowInsecureTransport: false
240
+ agent:
241
+ propagateTraceContext: true
242
+ propagateToSubagents: true
243
+ writeCorrelationEntry: false
244
+ workflow:
245
+ enabled: true
246
+ ```
247
+
248
+ ## 6. Development Defaults
249
+
250
+ ```yaml
251
+ otlp:
252
+ endpoint: http://localhost:4318
253
+ protocol: http/protobuf
254
+ privacy:
255
+ redactionEnabled: true
256
+ allowInsecureTransport: true # development localhost only
257
+ capture:
258
+ prompts: false
259
+ responses: false
260
+ ```
261
+
262
+ ## 7. Local Grafana Query Development
263
+
264
+ For the bundled `observability-stack/`, the supported `/obs` command path is authenticated Grafana through nginx HTTPS at `https://observability.local`. The default stack does not publish Grafana on `localhost:3000`; use a direct `http://127.0.0.1:<port>` Grafana URL only for tests or a custom Compose override.
265
+
266
+ ```yaml
267
+ query:
268
+ enabled: true
269
+ links:
270
+ traceUrlTemplate: https://observability.local/explore?left=...
271
+ grafana:
272
+ url: https://observability.local
273
+ token: ${OBSERVME_GRAFANA_TOKEN} # preferred service-account/bearer token
274
+ username: admin # local Basic auth fallback
275
+ password: ${OBSERVME_GRAFANA_PASSWORD}
276
+ datasourceUids:
277
+ tempo: tempo
278
+ loki: loki
279
+ prometheus: prometheus
280
+ tls:
281
+ insecureSkipVerify: true # local self-signed cert only
282
+ transport:
283
+ preferIPv4: true # avoids observability.local IPv6 stalls
284
+ ```
285
+
286
+ Rules:
287
+
288
+ - Create a Grafana service-account token with Viewer access for read-only datasource queries and export it as `OBSERVME_GRAFANA_TOKEN`, or export/set `OBSERVME_GRAFANA_PASSWORD` from `observability-stack/secrets/grafana_admin_password` for local Basic auth. These values may come from system environment variables or a trusted project `.env` copied from `.env.example`.
289
+ - Browser login cookies are not used by the extension; `/obs` commands call the Grafana API directly from the Pi process.
290
+ - A resolved `query.grafana.token` is sent as `Authorization: Bearer ...` and takes precedence.
291
+ - When the token is blank or an unresolved placeholder, a resolved `query.grafana.username` and `query.grafana.password` are sent as Basic auth for local development.
292
+ - Query-backed commands and `/obs health` must fail fast before Grafana calls when Grafana auth is unresolved/missing/incomplete, `query.grafana.url` is invalid, or a required datasource UID is blank.
293
+ - `/obs health` must report Grafana `401`/`403` responses as authentication failures and must not print token or password values.
294
+ - `tls.insecureSkipVerify=true` is only for local self-signed certificates; production should trust the CA instead.
295
+ - `transport.preferIPv4=true` uses Node's local HTTP(S) transport with IPv4 DNS lookup for Grafana calls.
296
+ - Provisioned datasource UIDs are `tempo`, `loki`, and `prometheus`; Loki selectors use normalized labels such as `service_name`, `pi_session_id`, `event_name`, and `event_category` for ObservMe data.
297
+
298
+ ## 8. Unsafe Debug Mode
299
+
300
+ Unsafe mode must require explicit opt-in:
301
+
302
+ ```yaml
303
+ privacy:
304
+ allowUnsafeCapture: true
305
+ capture:
306
+ prompts: true
307
+ responses: true
308
+ thinking: true
309
+ toolArguments: true
310
+ toolResults: true
311
+ ```
312
+
313
+ To show redacted LLM chat content in Grafana Tempo and Loki, set `OBSERVME_CAPTURE_PROMPTS=true`, `OBSERVME_CAPTURE_RESPONSES=true`, `OBSERVME_CAPTURE_THINKING=true`, keep `OBSERVME_REDACTION_ENABLED=true`, and set `OBSERVME_HASH_SALT` before the conversation occurs. To show failed-tool output in the Tools dashboard, set `OBSERVME_CAPTURE_TOOL_RESULTS=true` with the same redaction and hash-salt safeguards; successful tool results remain span-only while failed output is emitted to the dedicated `tool.error.captured` Loki stream. Set `OBSERVME_ALLOW_UNSAFE_CAPTURE=true` only when redaction is disabled for intentionally raw local debugging. Dashboards show only new events emitted after these settings and the updated Collector are active; older data dropped by the Collector cannot be recovered.
314
+
315
+ ObservMe must display a warning when unsafe capture is active. Redacted capture must pass all configured redactors, and raw unsafe capture is permitted only when redaction is explicitly disabled with a separately validated exception.
316
+
317
+ ## 9. Validation Rules
318
+
319
+ Reject config when:
320
+
321
+ - `allowUnsafeCapture=false` and `redactionEnabled=false` while any content capture is true.
322
+ - Production endpoint uses `http://` and `allowInsecureTransport` is not true.
323
+ - `otlp.protocol=http/protobuf` but a signal-specific exporter URL omits the required `/v1/traces`, `/v1/metrics`, or `/v1/logs` path.
324
+ - Metric labels include high-cardinality fields such as workflow IDs, session IDs, agent IDs, parent/child agent IDs, trace IDs, span IDs, entry IDs, spawn IDs, or spawn tool-call IDs.
325
+ - Project-local config is read while `ctx.isProjectTrusted()` is false.
326
+ - Propagated workflow or agent lineage values are malformed, too long, or contain unsafe characters.
327
+ - Queue sizes exceed configured memory guardrails.
328
+
329
+ ## 10. Minimal Config
330
+
331
+ ```yaml
332
+ observme:
333
+ otlp:
334
+ endpoint: http://localhost:4318
335
+ ```
336
+
337
+ Everything else uses safe defaults.
@@ -0,0 +1,33 @@
1
+ # ObservMe Source Notes
2
+
3
+ This document captures external technical assumptions referenced by the design and the official documentation sources used for cross-checking.
4
+
5
+ ## Pi
6
+
7
+ - Pi extension lifecycle, event names, command registration, `ExtensionContext`, `ExtensionCommandContext`, and tool hooks are based on the official Pi `docs/extensions.md` documentation.
8
+ - Pi extension factories may run before any session starts and may run in invocations that never start a session; background resources such as exporter timers must therefore be started from `session_start` and cleaned up from `session_shutdown`.
9
+ - Pi session JSONL format, entry types, tree behavior, and `SessionManager` APIs are based on the official Pi `docs/session-format.md`, `docs/sessions.md`, and `docs/compaction.md` documentation plus installed TypeScript declarations under `@earendil-works/pi-coding-agent/dist/`.
10
+ - Important event names used by ObservMe include `session_start`, `agent_start`, `agent_end`, `turn_start`, `before_provider_request`, `after_provider_response`, `message_start/update/end`, `tool_execution_start/update/end`, `tool_call`, `tool_result`, `user_bash`, `model_select`, `thinking_level_select`, `session_compact`, `session_tree`, and `session_shutdown`.
11
+ - Pi exposes `ctx.isProjectTrusted()` and `CONFIG_DIR_NAME`; ObservMe project-local config must use these instead of hardcoding `.pi` or reading untrusted project config.
12
+ - Pi does not expose a dedicated built-in "subagent spawned" lifecycle event. Workflow/agent/subagent lineage in ObservMe is an extension-level concern implemented by wrapping subagent launch/wait/join points and propagating W3C trace context plus ObservMe workflow/lineage environment variables.
13
+
14
+ ## OpenTelemetry
15
+
16
+ - OpenTelemetry Collector receives, processes, and exports traces, metrics, and logs through configurable pipelines of receivers, processors, exporters, and service pipelines.
17
+ - OTLP is the preferred protocol between ObservMe and the Collector.
18
+ - OTLP/HTTP uses signal paths such as `/v1/traces`, `/v1/metrics`, and `/v1/logs`; OpenTelemetry JS exporters may require signal-specific `url` values even when ObservMe config stores a base endpoint.
19
+ - Collector use is recommended for production because it centralizes batching, retries, filtering, routing, sampling, authentication, and backend decoupling.
20
+ - Advanced Collector components such as `prometheusremotewrite`, `probabilistic_sampler`, and `tail_sampling` may require the Collector Contrib distribution or a vendor distribution.
21
+ - OpenTelemetry GenAI semantic conventions define `gen_ai.*` attributes and metrics for model/client/agent telemetry. In the OpenTelemetry JS semantic-conventions package these GenAI constants are experimental/evolving, so ObservMe also keeps stable `observme_*` product metrics and `pi.*` domain attributes.
22
+ - Current GenAI attributes include `gen_ai.agent.id`, `gen_ai.agent.name`, `gen_ai.agent.version`, `gen_ai.tool.*`, `gen_ai.operation.name`, `gen_ai.provider.name`, `gen_ai.request.model`, `gen_ai.response.model`, `gen_ai.usage.*`, and metrics such as `gen_ai.client.operation.duration` and `gen_ai.client.token.usage`.
23
+ - W3C trace context (`traceparent`/`tracestate`) is the standard way to propagate parent trace identity across subagent process boundaries; if propagation is unavailable, ObservMe should record span links or equivalent log attributes. ObservMe's `pi.workflow.*` attributes are extension-defined correlation fields for orchestrator/agent-tree drill-down and are not official OTEL semantic conventions.
24
+ - `deployment.environment.name` is the official OpenTelemetry deployment-environment resource attribute; `observme.environment` is only a compatibility alias.
25
+ - `service.instance.id` and `observme.instance.id` identify an ObservMe telemetry session/process startup; they do not replace `pi.workflow.id` or `pi.agent.id` for logical workflow and parent/child agent lineage.
26
+
27
+ ## Grafana Stack
28
+
29
+ - Tempo is the reference trace backend and accepts OTLP spans through gRPC or HTTP endpoints such as `/v1/traces` for OTLP/HTTP.
30
+ - Loki is the reference log backend and can ingest OpenTelemetry logs through the OTLP HTTP endpoint using the Collector `otlphttp` exporter with an endpoint such as `http://loki:3100/otlp`.
31
+ - Loki stores many OTLP attributes as structured metadata and normalizes dots to underscores for queries, for example `event.name` -> `event_name`, `pi.session.id` -> `pi_session_id`, `pi.workflow.id` -> `pi_workflow_id`, and `pi.agent.id` -> `pi_agent_id`.
32
+ - Prometheus can receive OTLP metrics over HTTP only when started with `--web.enable-otlp-receiver`; the base endpoint is `/api/v1/otlp`, while explicit signal URLs use `/api/v1/otlp/v1/metrics`.
33
+ - Mimir is the reference production-scale Prometheus-compatible metrics backend; Collector remote write to Mimir uses endpoints such as `/api/v1/push`.