Org in a Box
Features

Learning Loop

How Org in a Box automatically learns from agent behaviour and proposes reusable skills.

Overview

After every agent session that reaches idle status, the reflection plugin:

  1. Loads the full session transcript
  2. Extracts a tool trajectory (ordered sequence of tool calls with input/output summaries)
  3. Hashes the trajectory using SHA-256
  4. Generates a reflection via LLM: "What worked? What failed? Any reusable patterns?"
  5. Stores the trajectory and reflection in the trajectories table with a pgvector embedding
  6. Checks for similar past trajectories (cosine similarity > 0.8, tool overlap ≥ 70%)
  7. When 3+ similar trajectories exist, auto-proposes a skill

Trajectory Hashing

Two trajectories are "similar" if:

  • Their tool sequences overlap by ≥ 70% (Jaccard-style: |intersection| / |max(A,B)|)
  • Their embeddings have cosine similarity > 0.8

This catches the same task approached slightly differently (different tool order, minor phrasing variations) without treating every unique task as a new pattern.

Skill Lifecycle

proposed → promoted → deprecated
StatusMeaning
proposedAuto-created by reflection plugin; not yet active
promotedAdmin approved; available to all agents in the tenant
deprecatedRetired; no longer shown to agents

Transition rules: proposed → promoted, proposed → deprecated, promoted → deprecated. No backwards transitions.

Managing Skills

Via admin API

GET /v1/skills?status=proposed
PATCH /v1/skills/:id/promote
PATCH /v1/skills/:id/deprecate

Via the TUI

/skills proposed     # list proposed skills awaiting review
/skills promoted     # list active skills

In the web dashboard

The admin panel Skills page shows proposed skills with their source trajectories. Click Promote to make a skill available to agents, or Deprecate to retire it.

What a Skill Contains

{
  "name": "competitive-analysis",
  "description": "Research 3+ competitors and produce a structured comparison",
  "body": "# Skill: Competitive Analysis\n\n## When to use\n...\n\n## Steps\n...",
  "triggers": ["compare competitors", "competitive analysis", "market research"],
  "status": "promoted",
  "version": 1
}

Promoted skills are written to SKILL.md files in the sandbox so opencode can reference them during planning.

Storage

TableDescription
trajectoriesOne row per session; tools JSONB, embedding vector(1536), reflection text
skillsVersioned skill definitions; source_trajectories array of trajectory IDs

Disabling

Set OIAB_REFLECTION_DISABLED=true to skip the reflection hook for a session, or remove @orginabox/plugin-reflection from opencode.jsonc.

On this page