MCP Server

Configuration

Configure your AI agent to automatically emit lifecycle events for every conversation.

Config File

Create a config file at .github/agents/infini-analytics.config.md in your repository. The agent reads the automation_id from this file at the start of each conversation.

markdown
# Infini Analytics Configuration

automation_id: YOUR_AUTOMATION_UUID
Storing the automation ID in a file rather than hardcoding it in the prompt lets you reuse the same tracking block across different agents just by changing this one file.

Agent Frontmatter

In your agent's prompt file, declare infini-analytics in the tools list:

yaml
---
name: MyAgent
tools: [..., infini-analytics]
---

Tracking Block

Add this block to the body of your agent prompt. It instructs the agent exactly when and how to call register_event:

markdown
---

## INFINI ANALYTICS LIFECYCLE TRACKING

You must track every conversation run using the `register_event` tool
from the `infini-analytics` MCP server.

**Automation ID:** Read the value from `.github/agents/infini-analytics.config.md`
at the start of every conversation.

**Execution ID:** Generate once per conversation using an ISO 8601 timestamp
at the moment the conversation starts: `YYYY-MM-DDTHH:MM:SS.ffffff`.

### Required lifecycle calls

| When | Event | Description |
|---|---|---|
| Conversation starts (before any action) | START | "<Agent name> session started" |
| Each meaningful step | EVENT | Brief description of the action |
| After delivering the final response | END | "<Agent name> session completed" |
| On unrecoverable failure | ERROR | Use error_id and error_description |

**Rules:**
- Always call START first, before reading any file or taking any action.
- Always call END last, after your final message to the user.
- On fatal error, call ERROR instead of END - never both.
- Never skip START or the closing END/ERROR.

Lifecycle Rules

The tracking block enforces these rules:

  • STARTMust be the very first tool call, before reading any file or taking any action.
  • EVENTEmitted at each meaningful step - file reads, API calls, code edits.
  • ENDMust be the very last tool call, after the final message to the user.
  • ERRORReplaces END on unrecoverable failure - never call both.