omp packages

@uselemma/pi0.2.1

Lemma SDK tracing for Pi coding-agent sessions

GitHub Actions Published 1 day ago MIT ~106 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

Lemma for Pi

@uselemma/pi sends completed Pi coding-agent turns to Lemma through the Lemma SDK ingest endpoint. It does not install MCP servers, Lemma skills, an investigation CLI, or an OTLP exporter.

Install

pi install npm:@uselemma/pi
pnpm dlx @uselemma/pi setup

The setup command opens Lemma's scoped coding-harness authorization page, lets you choose one project, and stores the returned scoped credential at ~/.pi/agent/lemma/credentials.json with private file permissions. Run the same command again to reconnect or rotate it.

Pi CLI sessions

The installed extension records Pi's prompt, model, and tool lifecycle events and sends one complete trace after the agent is fully settled, including automatic retries, compaction retries, and queued continuations. Current Pi CLI releases do not expose an @earendil-works/pi-telemetry context to extensions, so the package uses Pi's native extension events as a compatibility bridge for CLI sessions.

Each completed turn is written to ~/.pi/agent/lemma/pending before it is sent. A turn whose delivery fails stays there and is sent after the next completed turn or when the next Pi session starts, so a network error or a Lemma outage delays a trace instead of losing it. Each send spends at most ten seconds on the backlog. A warning names the cause; only a key Lemma rejects asks you to run setup again. When Lemma rejects the key (HTTP 401 or 403: it was revoked, or the person who approved it left the organization), delivery stops, and each new Pi session starts with a warning to rerun setup; setup stores a new key, and delivery resumes with the queued traces. At most 200 traces wait in pending; older ones are dropped, whatever kept them from being sent, and the next Pi session says how many.

Pi AgentHarness sessions

Pi applications that construct AgentHarness can use the telemetry interface directly:

import { AgentHarness } from "@earendil-works/pi-agent-core";
import { createLemmaPiTelemetryContext } from "@uselemma/pi";

const { harness } = await AgentHarness.create({
  // Pi session, model, tools, and resources...
  context: createLemmaPiTelemetryContext(),
});

The exporter maps pi.ai.request spans to Lemma generations, pi.harness.tool spans to Lemma tools, and other Pi telemetry spans to regular SDK spans. It posts only to /traces/ingest, once per root operation, and reports a failed send through onDeliveryError without retrying it.

Generated scripts/ and extensions/ are not committed. Build them with pnpm --filter @uselemma/pi build before tests or pack.