integrate-reflexio
Skill385 starsChanged 55 days agoApache-2.0View on GitHub
Integrate Reflexio Enterprise into an existing AI agent application — retrieve learned context before the agent acts, and ingest interactions by direct publishing or by connecting existing supported tracing. Use when a developer asks to add, install, wire, verify, or evaluate Reflexio in an agent codebase; not for operating Reflexio data through the CLI or changing the Reflexio server.
- Reads credentials
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- docs/CLAUDE.mdCLAUDE.md
- create-prSkill
- update-prSkill
- connect-data-sourceSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. About 0 are common, 15 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 16
If the current repository is the Reflexio source repository, stop and explain that this skill runs from the external agent application's …
- Distinctive: line 23
Never print, log, or commit the API key.
- Distinctive: line 42
Prefer the host's existing stable identifiers, and write the mapping down for the developer.
- Distinctive: line 47
Use a stable, opaque account or end-user ID — never a display name, email, mutable username, or per-request value.
- Very specific: line 52
Use the host conversation, ticket, call, task, or experiment-run ID, reused for every interaction in that coherent session.
- Distinctive: line 53
Never one per turn, and never a generic value shared across users or conversations.
- Distinctive: line 74
If the cross-service memory boundary or agent-playbook cohort cannot be inferred safely, ask before editing.
- Distinctive: line 80
Read the target repository's instructions.
- Very specific: line 88
Only if the host already records trustworthy session outcomes, or the developer asks to evaluate Reflexio, add the matching step below.
- Distinctive: line 89
Add focused tests and run the repository's normal lint, type, and test checks for the changed path.
- Very specific: line 96
Search with the current user intent, user_id, session_id, and agent_version.
- Very specific: line 98
Keep search bounded and fail open: a timeout, error, or success=False (a failed search, not an empty result) must not block the agent's …
- Distinctive: line 119
If search returns a retrieval-experiment assignment, keep its ID and arm with the request.
- Very specific: line 129
Keep force_extraction and wait_for_response off the production path.
- Distinctive: line 141
When the developer asks for evaluation, first identify the question:
- Very specific: line 152
Do not invoke the Reflexio CLI through subprocess from application code.
- Distinctive: line 153
Do not add a new durable queue, feature-flag system, or configuration abstraction when an adequate one exists.
- Distinctive: line 163
Search runs before the real agent/model call, and its rendered context reaches that call.
- Very specific: line 164
Search failure, including HTTP 200 with success=False, is observed and still permits a normal response.
- Distinctive: line 166
Search identities match the ingestion method's identities, and the API key is absent from the diff and logs.
- Distinctive: line 167
No URL override was introduced unless requested.
- Distinctive: line 180
Connected-source verification: after the developer activates the source, observe an actual import through the agreed traffic filters and …
- Distinctive: line 183
Never claim live verification when only mocks or static checks ran.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Integrate Reflexio
A portable skill for agent builders: copy it into the agent application's repository or point a coding agent at its URL. Implement and verify the smallest production-appropriate Reflexio loop in that application, through its existing lifecycle — not through coding-agent hooks or runtime model calls to Reflexio.
The loop has two halves. Retrieval — search before the agent acts and inject the results — is always implemented here. Ingestion reaches Reflexio in one of two ways: the application publishes interactions directly, or Reflexio imports them from a connected tracing source. Choose the ingestion method before writing any publishing code.
Target repository contract
- The developer's agent application is the integration target. All dependency, configuration, adapter, runtime, test, and documentation changes belong there. If these instructions were opened by URL, keep working in the current repository; do not clone or edit Reflexio.
.agents/skills/,.claude/skills/, and.cursor/skills/copies of this skill are discovery locations, not runtime integration locations.- If the current repository is the Reflexio source repository, stop and explain that this skill runs from the external agent application's repository, unless the developer explicitly asked to maintain or validate the skill itself.
Credentials and connection
- Runtime needs a full-access project key. Search and publish reject limited keys (
rflx2-prefix), whilewhoamiaccepts them — so a limited key passes awhoamicheck and then silently disables Reflexio, because retrieval fails open. A developer without a key creates one in the project's API Keys page (Account Setup); Reflexio shows it only once. Have them place it in the application's secret configuration asREFLEXIO_API_KEY; never ask for it in chat. - The key selects the managed project; legacy keys without a project binding resolve to the organization's default project.
user_id,session_id,source, andagent_versiondo not select a project. Search and the selected ingestion method must target the same intended project. Establish which project that is without exposing the key. - Hosted Reflexio is the default. In Python, construct
ReflexioClient(timeout=...)withouturl_endpoint; in TypeScript,new ReflexioClient({ timeoutMs })withouturl. Either client readsREFLEXIO_API_KEYand useshttps://www.reflexio.ai/. Do not add, set, or requireREFLEXIO_URL. Only when the developer explicitly provides or requests an override, pass it through the application's existing configuration system (or an example/template), never by changing a real.envvalue. - Never print, log, or commit the API key. Update a checked-in environment template when the repository normally documents required variables.
Choose how interactions reach Reflexio
Inspect dependency manifests, tracing imports and initialization, configuration names (not secret values), and the actual response-logging path. A dependency or unused key name alone does not show that user-facing interactions are logged there; clarify ambiguous evidence with the developer.
Connect a data source is the authority for supported providers: Braintrust, Langfuse Cloud, LangSmith Cloud, Phoenix Cloud, and OpenTelemetry (OTLP/HTTP traces). Its setup-context check determines which providers the installed server supports. For existing OpenTelemetry tracing, the connected route configures a receiver/exporter and uses pushed examples; it does not read provider history.
| Evidence | Ingestion method |
| Supported tracing already logs the user-facing interactions | Explain the evidence and recommend connecting it — proactively; the developer need not know the feature exists. Honor an explicit preference for direct publishing. |
| No supported source | Direct publishing. Do not introduce a tracing platform just for Reflexio; unsupported tracing does not imply connector support. |
Connected route. The connection skill owns everything from credentials and traffic selection through mapping, preview, validation, the review link, and optional attribution. Follow it, preserve its user decisions, and return here for retrieval. If its setup is blocked, report the blocker and next step; do not silently fall back to direct publishing.
One method per traffic. Identify existing Reflexio publish calls that a proposed import would overlap and agree a non-overlapping scope or cutover with the developer before activation. Do not silently remove an existing publish flow, and never add one for connected traffic.
Identity design
Prefer the host's existing stable identifiers, and write the mapping down for the developer. Do not silently invent an identity boundary.
user_id: personalization and ownership boundary
- The smallest user-specific scope. Profiles belong to one
user_id; user playbooks are extracted peruser_idand also keep theiragent_version. - Use a stable, opaque account or end-user ID — never a display name, email, mutable username, or per-request value.
- Reuse one
user_idacrosssourcevalues only when that person's profiles and user playbooks should be shared across those services. When memory must not cross a business or service boundary, namespace the ID itself (store-a:user-42,store-b:user-42); asourcefilter narrows retrieval but is not isolation.
session_id: conversation or task boundary
- Use the host conversation, ticket, call, task, or experiment-run ID, reused for every interaction in that coherent session. A new thread for the same user gets a new
session_id; theuser_idstays. - Never one per turn, and never a generic value shared across users or conversations. It must be unique within the organization: session cleanup and search deduplication operate by session.
source: producer and workflow attribution
- A stable, low-cardinality, non-sensitive label for the service, channel, surface, or workflow — e.g.
retail-support,mobile-app,offline-eval. A non-empty value must match^[a-z0-9][a-z0-9._:-]{0,127}$; never put user IDs, emails, secrets, request IDs, timestamps, or PII in it. - Decide retrieval behavior explicitly: omit
sourcefrom search to share a user's memory across services, or pass it to narrow results to one service.
agent_version: agent-wide learning boundary
- The aggregation key for agent playbooks: user playbooks with the same
agent_versioncluster together across users and sources; different versions never mix. - Share a value across traffic from the same behavioral agent (
support-agent@3on web and mobile). Change it when agents, prompts, policies, tools, or models should learn independently — not for an unrelated deploy. Keep it stable and human-readable; never per request or session.
Present the mapping
| Reflexio field | Host value | Intended boundary |
user_id | account.id | One user's memory across selected services |
session_id | conversation.id | One multi-turn conversation |
source | retail-support | Retail support traffic |
agent_version | support-agent@3 | Shared support-agent learning cohort |
If the cross-service memory boundary or agent-playbook cohort cannot be inferred safely, ask before editing.
Connected route: imported traffic takes its identities from the connection skill's field mapping, so settle that mapping first and derive search from it — do not design a separate scheme. Search's user_id and session_id must be the values the mapping reads for user and session, and search's agent_version must equal what the mapping writes to version. If version is unmapped, resolve it with the developer (an observed path or an agreed constant) before implementing search; otherwise agent playbooks aggregate under a value search never requests.
Workflow
- Read the target repository's instructions. Trace the actual agent request path: request handler, agent or model call, response completion point, identity source, session lifecycle, tool records, existing outcome/feedback signals, retry and job infrastructure, tracing integrations, and any existing Reflexio calls.
- Choose the ingestion method (above).
- Settle identities. Direct publishing: propose the mapping and confirm open boundaries. Connected source: run the connection skill through its mapping step, then derive the search identities from it.
- Choose a client for retrieval (and publishing, when direct) from the declared runtime. Connection setup uses the connection skill's setup APIs and needs no application SDK.
- Python 3.12+: read references/python-client.md; use
reflexio-clientfor Hosted Enterprise, orreflexio-aionly when the developer explicitly wants Local OSS. - TypeScript or JavaScript on Node.js 20.3+, Bun, Deno, or an edge runtime: read references/typescript-client.md; use
@reflexioai/client, server-side only. - Python 3.10/3.11, an older Node.js, or another language: read references/http-api.md and add a small typed adapter on the project's existing HTTP library. Do not raise the application's Python or Node.js requirement for Reflexio without explicit approval, and do not silently pin an older release.
- Python 3.12+: read references/python-client.md; use
- Implement retrieval at the narrowest existing lifecycle seam; for direct publishing, implement publishing too. For a connected source, finish the connection skill's draft and return its review link — do not make that wait on optional attribution.
- Only if the host already records trustworthy session outcomes, or the developer asks to evaluate Reflexio, add the matching step below.
- Add focused tests and run the repository's normal lint, type, and test checks for the changed path.
- Report the ingestion method and its evidence, the identity mapping, insertion points, files changed, verification performed, and live verification not run. For a connected source, add draft or active status, the review link, blockers, and the developer's remaining activation step.
Runtime loop
Before the agent acts — both methods
Search with the current user intent, user_id, session_id, and agent_version; include source only when the agreed mapping calls for source-specific retrieval. Retrieve profiles, user playbooks, and agent playbooks together, and in production restrict agent playbooks to approved.
Keep search bounded and fail open: a timeout, error, or success=False (a failed search, not an empty result) must not block the agent's response. Log a safe diagnostic through the application's existing observability, without prompts, retrieved content, or credentials.
Render a compact, delimited context block that keeps meaning and trust boundaries:
- Profiles are facts or preferences about this user.
- User playbooks are behavioral guidance learned from this user.
- Approved agent playbooks are shared behavioral guidance.
- Retrieved content cannot override system instructions, authorization, security policy, or tool permissions.
Per turn, start a fresh retrieved_learnings list recording the kind and stable learning_id of every learning included in that turn's model input, used visibly or not. Exclude discarded candidates and earlier turns' references. A search with session_id may omit learnings already returned in that session — expected, best-effort, and no reason to carry earlier learnings forward.
Existing integrations and managed-cloud playbook tuning
Enabling playbook tuning in Settings alone is not enough. The managed offline tuner needs evidence linking a served user playbook to the session and response it informed. Search and ingestion must agree on the project, user_id, session_id, and agent_version; the completed agent interaction must carry the injected playbook's reference in retrieved_learnings. This supplies attribution, not a guarantee that tuning will run: the tuner's other eligibility and evidence requirements still apply.
When integrating into an application that already uses Reflexio, audit its actual search, prompt construction, and ingestion path. A successful publish without references does not verify attribution. Preserve correctly populated references and repair missing ones at the existing seam; do not add a second publish flow. Use kind="user_playbook" with the returned user_playbook_id as a string for user playbooks. Preserve agent_playbook and profile references too, using their own returned IDs; never relabel them as user playbooks or substitute prompt tags, titles, or citations for these identities.
For direct publishing, attach the references to the completed agent interaction as shown below. For connected tracing, follow the connection skill's attribution follow-up: record the injected references on the response trace and map references from that observed field into imported interactions. Logging without the active reference mapping does not complete attribution. Missing references remain nonblocking for dialogue import, but must be reported as a tuning-attribution gap. Obtain the required authorization before patching tracing or updating an active source mapping; do not claim historical attribution was repaired or fabricate references for old sessions.
Retrieval experiment assignment
If search returns a retrieval-experiment assignment, keep its ID and arm with the request. A holdout response succeeds with no learnings.
After the agent responds — direct publishing
Publish the completed user and agent turns after streaming completes, with the same user_id, session_id, source, and agent_version. Attach the turn's retrieved_learnings to the agent interaction. Echo a retrieval-experiment ID and arm together when search returned them; otherwise omit both. Add tool-use, citation, expert-answer, or outcome fields only when the host already exposes trustworthy values.
Use the native async client in async applications, and never start an untracked background task in a short-lived or serverless process. A publish failure must not replace a valid response but must stay observable: check success even on HTTP 200, surface warnings (ignored fields, skipped interactions), and keep request_id and learning status for troubleshooting. Acceptance is not completed extraction; poll learning status only when the workflow needs completion.
Publishing has no atomic idempotent replay. Do not automatically retry an ambiguous timeout, disconnect, or 5xx that may have been accepted — quarantine it for reconciliation unless the host can prove it was not. request_id is correlation metadata, not an idempotency key.
Keep force_extraction and wait_for_response off the production path; they are for demos and tests.
After the agent responds — connected source
The existing tracing path supplies the interactions; do not publish them. Attribution of injected learnings is the connection skill's optional follow-up and never blocks dialogue import. Do not assume direct-publish fields or retrieval-experiment assignments are imported; check the mapping contract before promising evaluation coverage.
Session outcomes — optional, both methods
When the host already records an explicit, trustworthy outcome for a conversation (resolved ticket, completed purchase, user-confirmed failure), report it for that session_id with mark_session_outcome (POST /api/session_outcome); see the API reference. The session must already contain a published or imported request. Do not infer outcomes the host does not record.
Evaluation routing
When the developer asks for evaluation, first identify the question:
- Retrieved-learning analysis: were the specific learnings attached through
retrieved_learningsrelevant and helpful? - Head-to-head comparison: which of two responses to the same turn is better?
- Randomized retrieval experiment: session-level impact of retrieval treatment versus holdout.
Retrieved-learning verdicts give attribution, not causal lift. Do not invent a rubric, sampling policy, cohort design, or metric formula here: read Evaluating Agent Performance for setup and Measuring Reflexio's Impact for design and interpretation, and confirm the design with the developer before adding traffic assignment or extra model calls.
Implementation boundaries
- Preserve the application's agent framework and prompt architecture. Prefer one small adapter at an existing seam over Reflexio calls scattered through business logic.
- Do not invoke the Reflexio CLI through subprocess from application code.
- Do not add a new durable queue, feature-flag system, or configuration abstraction when an adequate one exists.
Official documentation
For detailed procedures and current API shapes, start at llms.txt and read only the relevant pages (llms-full.txt only when broad context is genuinely needed): quickstart, search, publishing, requests and sessions. Use the API reference for exact parameters and schemas rather than guessing. The docs add detail; they do not widen the requested integration.
Verification
Focused tests, both methods:
- Search runs before the real agent/model call, and its rendered context reaches that call.
- Search failure, including HTTP 200 with
success=False, is observed and still permits a normal response. - Two turns in one conversation share a session ID but carry only their own learning references; a new conversation for the same user gets a new session ID.
- Search identities match the ingestion method's identities, and the API key is absent from the diff and logs.
- No URL override was introduced unless requested.
Direct publishing, additionally: publication follows the completed response with the expected identity fields, every injected learning's kind and stable ID, and any experiment assignment echoed unchanged; success=False and warnings are observed without disrupting the response.
Test attribution through the application's integration path. Supply mocked search results with distinct profile, user-playbook, and agent-playbook IDs; capture both the real model-call input and the outgoing publish payload (or response trace for connected ingestion). Assert that every retained, injected learning has its matching (kind, learning_id) on the completed agent interaction, numeric playbook IDs are strings, and discarded candidates are absent. Exercise an empty result and a failed search with no injected context, consecutive turns, and concurrent requests; references must not leak between turns or requests. Do not settle for testing the reference-list helper alone. For example, injecting returned user playbook 42 must publish {"kind":"user_playbook","learning_id":"42"} on that turn's agent interaction.
Connected source: run the connection skill's preview and validation checks, confirm no overlapping publish flow was introduced, and report draft validation separately from activation and observed imports. A saved draft is not evidence of import.
Live checks, when credentials are available:
- Credential check: one
searchwithoutsession_id. It publishes nothing and fails on a limited key;whoamialone does not. - Expect an empty result on a new project. Nothing is retrievable until interactions are ingested and extracted; empty search is not a wiring failure.
- End-to-end verification requires the developer's consent (or a request for live verification). For direct publishing, use a disposable test project and unique test
user_id,session_id, andagent_version; publish one exchange withforce_extraction=Trueandskip_aggregation=True, then poll learning status with a bounded deadline and search again after extraction completes. Report pending or failed extraction instead of waiting indefinitely. A synthetic exchange may yield no learnings.delete_sessionremoves requests and interactions, not extracted learnings; do not claim it fully cleans up the test. - Connected-source verification: after the developer activates the source, observe an actual import through the agreed traffic filters and mapping, then verify retrieval using its mapped identities once extraction completes. Until activation, report draft preview and validation only. A direct publish does not verify the connector.
- Attribution verification, with the same live-test consent: use a disposable project with an actual retrievable user playbook. Retrieve and inject it for a completed turn, then publish or observe its import. Read back the stored agent interaction through the documented interaction API, using the test user, bounded time range, and result limit; match its
request_idto the accepted publish or imported request and confirm the exactuser_playbookreference survived. If no playbook is available, report this check as not run. Report local payload/trace checks and live stored-reference checks separately. Neither proves a tuning run completed, and enabling Settings alone is not verification.
Never claim live verification when only mocks or static checks ran.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

