# ce-session-retro

Adopt this skill: https://proskills.md/skills/other/basjoo-io-basjoo-cursor-skills-compound-engineering-ce-session-retro

Page: https://proskills.md/skills/other/basjoo-io-basjoo-cursor-skills-compound-engineering-ce-session-retro
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: .cursor/skills/compound-engineering/ce-session-retro/SKILL.md
size: 8042
upstream: https://github.com/basjoo-io/basjoo/blob/master/.cursor/skills/compound-engineering/ce-session-retro/SKILL.md

````text
---
name: ce-session-retro
description: >
  CE workflow retrospective with six-dimension analysis. Use when reviewing
  a completed or partially completed /run-ce-workflow task for dispatch
  accuracy, workflow friction, and skill/agent effectiveness. Triggers:
  /ce-session-retro, session retro, CE 复盘, 工作流复盘, workflow retro.
disable-model-invocation: true
argument-hint: "[task-id]"
---

# CE Session Retrospective

**Announce at start:** "I'm using the ce-session-retro skill to review this CE workflow session."

## Overview

Structured retrospective for `/run-ce-workflow` sessions. Analyzes six dimensions: (1) workflow execution quality, (2) missed dispatches, (3) spurious dispatches, (4) workflow process optimization, (5) individual skill/agent effectiveness, and (6) other observations. Produces actionable improvement items that feed back into skill/agent/workflow updates.

## When to Use

- After completing (or partially completing) a task via `/run-ce-workflow`
- When the user wants to review a CE workflow session for improvements
- As part of a periodic CE workflow health check

**When NOT to use:** General session retrospectives unrelated to the CE workflow — use `/session-retro` instead.

## Parameters

- `task-id` (optional): Reads `docs/tasks/<task-id>.yaml` for stage history. If omitted, infer from the most recent task YAML in `docs/tasks/`.

## Inputs

| Source                                             | Purpose                                               |
| -------------------------------------------------- | ----------------------------------------------------- |
| `docs/tasks/<task-id>.yaml`                        | Stage history, gate decisions, agent failures, timing |
| Current session transcript                         | Actual skill/agent invocations, friction points       |
| `agent-transcripts/` directory                     | Prior session transcripts for multi-session tasks     |
| `.cursor/skills/compound-engineering/`         | Skill inventory for dispatch analysis                 |
| `compound-engineering.local.md`                | Configured conditional agents                         |
| `run-ce-workflow/references/audit-protocol.md` | Expected agent dispatch per stage                     |
| `docs/retros/`                                     | Prior retro reports for pattern detection             |

Create TodoWrite todos when invoked:

```
TodoWrite todos:
  - id: "rt-1", content: "Phase 1: Gather evidence (task YAML + transcript + skill inventory + prior retros)", status: "pending"
  - id: "rt-2", content: "Phase 2: Analyze workflow execution quality", status: "pending"
  - id: "rt-3", content: "Phase 3: Audit skill/agent dispatch accuracy", status: "pending"
  - id: "rt-4", content: "Phase 4: Evaluate workflow process optimization", status: "pending"
  - id: "rt-5", content: "Phase 5: Review individual skill/agent effectiveness", status: "pending"
  - id: "rt-6", content: "Phase 6: Synthesize findings + propose actions", status: "pending"
```

## Phase 1: Gather Evidence

### 1.1 Load task state

Read `docs/tasks/<task-id>.yaml`. Extract:

- Stages completed (`status` history, `sessions[]`)
- Gate decisions and dates
- Agent failures (`agent_failures[]`)
- Audit iterations and findings counts
- Timing signals (session count, stages per session)

If task YAML is missing or incomplete, ask the user to describe the session.

### 1.2 Reconstruct dispatch history

Gather transcript evidence from all available sources:

1. **Current session**: The conversation context contains what happened this session — scan for skill announcements ("I'm using the * skill"), Task tool dispatches, AskQuestion interactions, error recovery, and manual interventions.
2. **Prior sessions**: If `sessions[]` in task YAML lists earlier sessions, check `agent-transcripts/` for matching `.jsonl` files. Read relevant transcripts to reconstruct dispatch history across the full task lifecycle.
3. **Task YAML signals**: `stages.<stage>.agent_failures`, `stages.<stage>.iteration`, and `stages.<stage>.conditional_agents` record dispatch facts even without transcripts.

Build a dispatch log: `{stage, skill_loaded, agents_dispatched[], gates_presented[], errors[]}` per stage.

If all three sources are empty (new session, no prior transcripts, no task YAML history), ask the user to describe what happened in the workflow session.

### 1.3 Load reference inventories

Read (on demand, not bulk):

- `run-ce-workflow/SKILL.md` — Stage Dispatch table, Supporting Skills
- `run-ce-workflow/references/audit-protocol.md` — expected agents per audit stage
- `compound-engineering.local.md` — configured conditional agents
- README.md — full skill and agent inventory

### 1.4 Review prior retros

Scan `docs/retros/` for previous retro reports. If prior retros exist:

- Extract recurring findings (same issue appearing in 2+ retros)
- Note previously proposed actions that were or weren't implemented
- Flag systemic patterns for escalation in Phase 6

If no prior retros exist, skip this step.

## Phase 2: Workflow Execution Quality

Evaluate each completed stage against its expected behavior:

| Check                 | What to look for                                                      |
| --------------------- | --------------------------------------------------------------------- |
| Stage ordering        | Did stages execute in the correct sequence? Any unexpected skips?     |
| Gate compliance       | Were all required gates presented? Were artifacts computed correctly? |
| Session boundaries    | Were context health assessments performed? Were handoffs generated?   |
| TodoWrite discipline  | Were stage-prefixed todos created and completed?                      |
| Per-stage read policy | Did the orchestrator avoid reading documents outside its read policy? |
| Error recovery        | Were failures handled per protocol (agent crashes, build failures)?   |

For each issue found, classify:

- **Protocol violation** — skill/workflow says X, but Y happened
- **Missed opportunity** — a better path was available but not taken
- **Friction** — correct behavior, but unnecessarily slow or confusing

## Phase 3: Skill/Agent Dispatch Audit

The core analysis. Two sub-dimensions:

### 3.1 Missed dispatches (should have been called, but weren't)

Determine expected dispatches by reading the **source of truth** dynamically — do NOT rely on memorized agent lists:

1. **Expected skills per stage**: Read `run-ce-workflow/SKILL.md` Stage Dispatch table
2. **Expected agents per audit stage (3/5/8)**: Read `run-ce-workflow/references/audit-protocol.md`
3. **Expected conditional agents**: Read `compound-engineering.local.md` and match globs against task diff
4. **Expected research agents (Stage 1)**: Read `brainstorming/SKILL.md` Phase 2 table
5. **Expected document reviewers (Stages 1/2/4)**: Read each stage's skill for reviewer dispatch

Compare expected vs actual (from Phase 1.2). Also check **supporting skills** that activate on triggers:

- `systematic-debugging` — were there any test/build failures during execution?
- `deepen-plan` — were there "plan insufficiency" findings in Stage 5?
- `reviewing-code` — was it used in Stage 8 when appropriate?
- GitNexus `impact`/`context` — were they called before modifying code?

For each miss: state which skill/agent, which stage, why it should have been called, and estimated impact (high/medium/low).

### 3.2 Spurious dispatches (called, but shouldn't have been)

Identify agents or skills that were dispatched unnecessarily:

- Agent dispatched for a stage where it's not in the core or conditional list
- Skill loaded when its trigger conditions weren't met
- Redundant dispatches (same agent called twice for the same review)
- Research agents dispatched when the information was already available
- Conditional agents activated despite no matching file globs in the diff

For each spurious dispatch: state which skill/agent, which stage, why i
````

## File: README.md
upstream: https://github.com/basjoo-io/basjoo/blob/master/README.md

````text
<h1 align="center">basjoo</h1>

<p align="center">
  <b>The fundamental math basis for autonomous driving vehicles and robotics.</b>
</p>

<p align="center">
  English | <a href="README.zh-CN.md">简体中文</a>
</p>

<p align="center">
  <a href="https://github.com/basjoo-io/basjoo/actions/workflows/ubuntu-x64.yml"><img src="https://github.com/basjoo-io/basjoo/actions/workflows/ubuntu-x64.yml/badge.svg" alt="ubuntu-x64"></a>
  <a href="https://github.com/basjoo-io/basjoo/actions/workflows/darwin-arm64.yml"><img src="https://github.com/basjoo-io/basjoo/actions/workflows/darwin-arm64.yml/badge.svg" alt="darwin-arm64"></a>
  <a href="https://github.com/basjoo-io/basjoo/actions/workflows/windows-x64.yml"><img src="https://github.com/basjoo-io/basjoo/actions/workflows/windows-x64.yml/badge.svg" alt="windows-x64"></a>
  <img src="https://img.shields.io/badge/C%2B%2B-23-blue.svg" alt="C++23">
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-BSD--3--Clause-blue.svg" alt="BSD-3-Clause"></a>
</p>

---

basjoo is a header-mostly **C++23** library with the math that planning and control stacks are built on: splines for paths, convex optimization for trajectory smoothing, bicycle models for motion planning, and the linear algebra under all of it. Every component is a fine-grained CMake/xmake target (`basjoo::math_vec2`, `basjoo::cvxopm_osqp_solver`, …), so you link only what you use.

## Modules

| Module    | Namespace         | What's inside                                                                                          |
| --------- | ----------------- | ------------------------------------------------------------------------------------------------------ |
| `common`  | `basjoo::common`  | FSM, spdlog-based logging, aligned allocators and PMR resources, timing and RAII helpers               |
| `math`    | `basjoo::math`    | Dense `Vec2`/`Vec3`/`Mat22`/`Mat33`/`Vector`/`Matrix` with LU/QR (optional BLAS/LAPACK, AVX-512); sparse DOK/LIL/COO/CSR/CSC with QDLDL; linear/cubic/quintic curves and functions; multivariate functions; FFT, Chebyshev, fixed-point, polygons, quaternions |
| `cvxopm`  | `basjoo::cvxopm`  | Sparse QP via OSQP; L-BFGS, BFGS, Nelder–Mead, and line-search solvers for dense problems              |
| `bicycle` | `basjoo::bicycle` | Route lines, paths, motions, borders, fences; QP-based acceleration/offset/kinematics planners; kinematics/dynamics models; PID, feed-forward, MPC, and flow controllers |
| `quadrotor` | `basjoo::quadrotor` | Rigid-body dynamics model driven by body torques and collective thrust |

Dependencies flow strictly `common → math → cvxopm → bicycle`; `quadrotor` sits beside `bicycle` and depends on `math` only. Curves, functions, and sparse matrices are type-erased through [Microsoft Proxy](https://github.com/microsoft/proxy) and serializable with [zpp_bits](https://github.com/eyalz800/zpp_bits).

## Getting started

The easiest environment is the devcontainer (`.devcontainer/`: GCC 16, Clang 22, CMake, xmake, uv). On your own machine you need CMake ≥ 3.31, Ninja, a C++23 compiler with `<mdspan>` (GCC ≥ 16, Clang ≥ 18 with libc++, or MSVC ≥ 19.39), Python ≥ 3.14 with [uv](https://docs.astral.sh/uv/), and optionally ccache. Every C++ dependency is fetched by [CPM](https://github.com/cpm-cmake/CPM.cmake).

```bash
git clone --recursive https://github.com/basjoo-io/basjoo.git && cd basjoo

# Python environment first: CMake/xmake locate nanobind in .venv
uv venv --system-site-packages
uv sync --no-install-project

# Build and test with a preset (linux-gcc-x64, linux-clang-x64, darwin-{gcc,clang}-arm64, windows-msvc-x64)
cmake --preset linux-gcc-x64
cmake --build --preset linux-gcc-x64
ctest --preset linux-gcc-x64

# ...or with xmake
xmake f -m release && xmake build && xmake test
```

`--system-site-packages` is required in the devcontainer, where ROS 2 pytest plugins import system-installed packages.

### Options

| CMake                       | xmake                        | Default    | Description                                       |
| --------------------------- | ---------------------------- | ---------- | ------------------------------------------------- |
| `BASJOO_BUILD_TESTING`       | `basjoo_build_testing`        | `ON`       | Build unit tests                                  |
| `BASJOO_CHECK_PARAMS`        | `basjoo_check_params`         | `OFF`      | Runtime parameter validation                      |
| `BASJOO_USE_BLAS_LAPACK`     | `basjoo_use_blas_lapack`      | `OpenBLAS` | `OpenBLAS` (`Netlib`, `MKL`: not implemented yet) |
| `BASJOO_USE_BOOST_UNORDERED` | `basjoo_use_boost_unordered`  | `ON`       | Use Boost.Unordered containers                    |
| `BASJOO_ENABLE_INSTALL`      | `basjoo_enable_install`       | `ON`       | Install and export rules                          |
| `BUILD_SHARED_LIBS`         | `--kind=shared`              | `OFF`      | Build shared libraries                            |

### Use from CMake

```bash
cmake --install out/build/linux-gcc-x64 --prefix /your/prefix
```

```cmake
find_package(basjoo REQUIRED)
target_link_libraries(your_target PRIVATE basjoo::math_piecewise_cubic_curve basjoo::cvxopm_osqp_solver)
```

## Examples

### Cubic spline curve

```cpp
#include "basjoo/math/curves/piecewise_cubic_curve.hpp"
#include "basjoo/math/dense/vec2.hpp"
#include "basjoo/math/functions/boundary_mode.hpp"

using namespace basjoo::math;

// 21 anchor points on a semicircle of radius 2
std::vector<Vec2d> anchors(21);
for (std::size_t i = 0; i < anchors.size(); ++i) {
    const double t = M_PI * i / 20.0;
    anchors[i] = Vec2d{2.0 * std::cos(t), 2.0 * std::sin(t)};
}

// Clamped boundary conditions (first derivative at both ends)
const BoundaryMode<Vec2d> b0{.order = 1, .derivative = Vec2d{0.0, 1.0}};
const BoundaryMode<Vec2d> bf{.order = 1, .derivative = Vec2d{0.0, -1.0}};
const PiecewiseCubicCurve<Vec2d> curve{anchors, b0, bf};

const Vec2d tangent = curve.tangent(1.0);
const double kappa  = curve.curvature(1.0);         // ≈ 0.5
const auto [s, l]   = curve.inverse(Vec2d{1.0, 1.0}); // Cartesian → Frenet
```

### Quadratic program (OSQP)

```cpp
#include "basjoo/cvxopm/problems/osqp_problem.hpp"
#include "basjoo/cvxopm/solvers/osqp_solver.hpp"

using namespace basjoo::cvxopm;

// min 2x₀² + x₁² + x₀x₁ + x₀ + x₁   s.t.  x₀ + x₁ = 1,  0 ≤ x₀, x₁ ≤ 0.7
OsqpProblem<double, int> problem(2, 3);
problem.updateQuadCostTerm(0, 0, 2.0);
problem.updateQuadCostTerm(1, 1, 1.0);
problem.updateQuadCostTerm(0, 1, 1.0);
problem.updateLinCostTerm(0, 1.0);
problem.updateLinCostTerm(1, 1.0);
problem.updateConstraintTerm(0, {{0, 1.0}, {1, 1.0}}, 1.0, 1.0);
problem.updateConstraintTerm(1, {{0, 1.0}}, 0.0, 0.7);
problem.updateConstraintTerm(2, {{1, 1.0}}, 0.0, 0.7);

const OsqpSolver<double, int> solver{Settings<double, int>{.polishing = true}};
const auto [result, info] = solver.solve(problem); // result.prim_vars ≈ {0.3, 0.7}
```

### Unconstrained minimization (L-BFGS)

```cpp
#include "basjoo/cvxopm/problems/dense_problem.hpp"
#include "basjoo/cvxopm/solvers/lbfgs_solver.hpp"
#include "basjoo/math/mdfunctions/rosenbrock_function.hpp"

using namespace basjoo;

const cvxopm::DenseProblem<double> problem(
    math::makeMdFunctionProxy(math::RosenbrockFunction<math::pmr::Vector<double>>(1.0, 100.0))
);
const cvxopm::LbfgsSolver<double> solver{cvxopm::Settings<double>{.eps_abs{1E-6}}};
const auto [result, info] = solver.solve(problem, math::pmr::Vector<double>({-1.0, 1.0}));
// result.prim_vars ≈ {1.0, 1.0}
```

More usage lives in the tests under [`tests/basjoo/`](tests/basjoo), which mirror the source tree.

## Python

`src/basjoo/` is also a Python package with a nanobind extension (`basjoo._core`), buildable as a wheel with scikit-build-core (`pyproject.toml`) or xmake-python (`pyproject.xmake.toml`). The bindings are scaffolding for now and do not expose an API yet.

## Contributing

Conventions for humans and coding agents are in [`AGENTS.md`](AGENTS.md) and [`.claude/rule
````
