Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
884f710
docs: Insi as a dependency any repo can add; Watchman's history as th…
cryptojoks Oct 2, 2026
5528b7c
docs: Insi PRD status — what Phase 1 built, what is left
cryptojoks Oct 2, 2026
3f5d7ea
CI: the gate every change passes, on Windows, macOS and Linux
cryptojoks Oct 2, 2026
764664d
/pr refuses a branch that adds a credential, before anything is pushed
cryptojoks Oct 2, 2026
27cb006
Lanes run their own check before they merge
cryptojoks Oct 2, 2026
b9bd78a
Lanes can be opened as pull requests and finished once merged
cryptojoks Oct 2, 2026
6d83969
docs: PRD status — insi mcp, issue, hook and init registration built
cryptojoks Oct 2, 2026
afe7fca
/pr refuses a branch that adds personal data, as it does a credential
cryptojoks Oct 2, 2026
333ffb4
docs: PRD row 4 — dollar budgets built
cryptojoks Oct 2, 2026
d0516c1
docs: PRD row 3 — 38 Watchman tasks validated, 35 fair
cryptojoks Oct 3, 2026
9f13810
docs: PRD — pilot findings and the interface brief
cryptojoks Oct 3, 2026
2397ff1
docs: PRD row 19 — CI workflow for agent PRs built
cryptojoks Oct 3, 2026
0b0252a
docs: PRD row 7 — topic rules built
cryptojoks Oct 3, 2026
12891ed
docs: PRD row 16 — the improvement loop built
cryptojoks Oct 3, 2026
243bad9
incode reads a harness folder named by INSI_HARNESS
cryptojoks Oct 3, 2026
2d76498
docs: PRD row 18 — sandbox for issue work built
cryptojoks Oct 3, 2026
40bf102
docs: PRD row 17 — connectors built
cryptojoks Oct 3, 2026
03d5ffc
docs: PRD row 20 — packaging ready, not published
cryptojoks Oct 3, 2026
432115c
docs: PRD rows 1, 6, 7, 16 — public check, lesson lifecycle, loop to …
cryptojoks Oct 9, 2026
8c2e88b
A task too long for a command line reaches the agent whole, as a file
cryptojoks Oct 9, 2026
883bc04
agy: a reply streamed in fragments is said once, whole
cryptojoks Oct 9, 2026
57bbcde
docs: PRD — Phase 1 measurement, run 2 result (one seed)
cryptojoks Oct 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# The gate every change passes before it merges: formatting, lints, and the
# library and binary tests, on the three platforms incode runs on.
#
# `/pr merge` refuses a pull request whose checks failed or are still
# running, so this workflow is what stands between a branch and `main`.
name: ci

on:
pull_request:
push:
branches: [main]

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check

test:
name: test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
# The Linux desktop backends (xcap, enigo's x11rb, AT-SPI over zbus)
# link against these at build time — the same set the Linux live tests
# were built with.
- name: Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
pkg-config clang libclang-dev libwayland-dev libpipewire-0.3-dev \
libxcb1-dev libxcb-randr0-dev libxcb-shm0-dev libdbus-1-dev \
libegl-dev libgbm-dev
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
# The tests create git repositories and commit in them.
- run: |
git config --global user.email "ci@example.invalid"
git config --global user.name "ci"
- run: cargo clippy --all-targets
- run: cargo test --lib
- run: cargo test --bins
119 changes: 77 additions & 42 deletions docs/Incord SI — Self-Improving Agent Harness (PRD).md

Large diffs are not rendered by default.

74 changes: 74 additions & 0 deletions docs/LANES_AS_PRS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Lanes as pull requests

Status: built. Builds on the lane check (each lane's check runs in its own
checkout before anything leaves it).

## What changes for the operator

Today a `/run` with `INCODE_LANES=N` merges each lane's branch into the
checked-out branch on this machine. With `INCODE_LANES_AS=pr`, a lane whose
own check passed is pushed and opened as a **draft** pull request onto the
branch the run is on, and nothing is merged locally. A person reviews and
merges it on GitHub. The run goes on with the other tasks.

## Why it is more than swapping `merge_lane` for `/pr`

The ledger's law is that a task reaches `Done` only through a passing check on
the tree the work is in. A lane opened as a pull request is neither done (its
work is not in the tree) nor running (no agent is on it) nor failed.

## What was built

1. **It waits `Blocked`, with the URL recorded** (`Task.pull_request`,
`Ledger::await_review`). The proposal was an eighth state, `InReview`; the
ledger holds itself to seven (`src/ledger.rs`), and `Blocked` already
means "a decision is outstanding with a person", which a review is. So
nothing picks it up, its dependants stay `Pending`, a run that drains
around it stops with `NothingRunnable` naming it, and the existing
progress and dashboard views show it as waiting on a person — with the
URL in its note.
2. **Opening** (`parallel::open_for_review`, `Merged::Opened { url }`): after
the lane check passes, the lane is sealed and opened through `/pr`'s own
path (`pull_request::open_onto`) with its refusals — nothing new, a
credential in the diff. `landed()` is false, and no report is cached, so
the runner never checks a tree without the change. A task with no check is
merged here instead: nothing could finish it after a review.
3. **The base is the branch the run is on**, not the forge's default: a lane
cut from a feature branch would otherwise carry that branch's commits.
Checked once at the start (`parallel::review_base`: a branch, not detached;
an `origin`; `gh` reachable; the branch on `origin`) and before each batch
(`parallel::nothing_unpushed`: HEAD has nothing `origin` lacks). If either
fails, the run says why and merges locally, as before.
4. **Coming back** (`reviews::settle`, at the start of every run, whatever
`INCODE_LANES_AS` says): for each task waiting on a pull request, the
forge is asked its state (`Forge::review`, `gh pr view --json
state,baseRefName`).
- Merged: if this checkout is on that base, it is fast-forwarded from
`origin` (only a fast-forward), the task's check runs, and only a pass
completes it. A failing check is a failed attempt. A checkout on another
branch, or one that cannot fast-forward, is left alone and the task
waits with a note saying to pull.
- Closed unmerged: a failed attempt; back to the queue with its branch
remembered (or set aside, if out of attempts).
- Open, or unreadable: left waiting.
5. **Off by default.** Without `INCODE_LANES_AS=pr` nothing is opened.

## Tests

- `parallel::a_lane_opened_for_review_is_pushed_and_not_merged`
- `parallel::a_review_base_must_be_on_the_remote_with_nothing_unpushed`
- `parallel::lanes_are_merged_here_unless_pull_requests_are_asked_for`
- `reviews::a_merged_pull_request_is_pulled_checked_and_done`
- `reviews::a_merged_pull_request_whose_check_fails_is_a_failed_attempt`
- `reviews::a_closed_pull_request_sends_the_task_back_with_its_branch`
- `reviews::an_open_pull_request_leaves_the_task_waiting`
- `reviews::a_checkout_on_another_branch_is_not_merged_into`
- `reviews::the_dependants_of_a_task_in_review_are_not_started`
- `pull_request::a_pull_requests_state_and_base_are_read`
- `pull_request::a_branch_is_opened_onto_the_base_it_is_given`

## Not yet exercised

A live run against GitHub. Every test stands in for the forge; the `gh`
calls (`pr view --json state,baseRefName`, `pr create --draft`) are the ones
`/pr` already makes, plus the state query.
42 changes: 34 additions & 8 deletions src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ pub enum Source {
Flag,
/// An environment variable set for this shell.
Environment,
/// The harness folder this run was given (`INSI_HARNESS`), over the
/// admin file for this run only.
Harness,
/// The admin file — the standing decision.
AdminFile,
/// The built-in fallback, which is a last resort and not a recommendation.
Expand All @@ -68,6 +71,7 @@ impl Source {
match self {
Self::Flag => "flag",
Self::Environment => "env",
Self::Harness => "harness",
Self::AdminFile => "admin file",
Self::BuiltIn => "built-in",
}
Expand Down Expand Up @@ -758,23 +762,30 @@ impl AdminConfig {
#[must_use]
pub fn resolve_roles(&self) -> Resolved<crate::roles::RoleTable> {
let from_env = crate::roles::RoleTable::from_env();
let harness = crate::harness::routing();
let (roles, tiers) = crate::harness::overlay(&self.roles, &self.tiers, harness.as_ref());
let mut table = crate::roles::RoleTable::default();
let mut used_file = false;
let mut used_harness = false;
let mut used_env = false;

for role in crate::roles::KNOWN_ROLES {
let from_env_role = from_env.candidates_for(role);
if from_env_role.is_empty() {
if let Some(models) = self.roles.get(role).filter(|m| !m.is_empty()) {
if let Some(models) = roles.get(role).filter(|m| !m.is_empty()) {
// `@top` becomes the models that tier holds. A role naming a
// tier nobody defined is reported by `unknown_tiers`, not
// silently emptied.
let (expanded, _) = crate::roles::expand_tiers(models, &self.tiers);
let (expanded, _) = crate::roles::expand_tiers(models, &tiers);
table = table.with_candidates(role, expanded);
used_file = true;
if harness.as_ref().is_some_and(|h| h.roles.contains_key(role)) {
used_harness = true;
} else {
used_file = true;
}
}
} else {
let (expanded, _) = crate::roles::expand_tiers(from_env_role, &self.tiers);
let (expanded, _) = crate::roles::expand_tiers(from_env_role, &tiers);
table = table.with_candidates(role, expanded);
used_env = true;
}
Expand All @@ -783,14 +794,25 @@ impl AdminConfig {
// The table's source is the strongest layer that contributed to it. Where
// the layers are mixed, `role_source` is the per-role truth and this is
// only a headline.
let source = match (used_env, used_file) {
(true, _) => Source::Environment,
(false, true) => Source::AdminFile,
(false, false) => Source::BuiltIn,
let source = match (used_env, used_harness, used_file) {
(true, ..) => Source::Environment,
(false, true, _) => Source::Harness,
(false, false, true) => Source::AdminFile,
(false, false, false) => Source::BuiltIn,
};
Resolved::new(table, source)
}

/// `roles` and `tiers` as this run uses them: the admin file's, with the
/// harness's over them key by key when the run was given one. Never
/// saved: the harness is this run's, the file is the operator's.
#[must_use]
pub fn effective_routing(
&self,
) -> (BTreeMap<String, Vec<String>>, BTreeMap<String, Vec<String>>) {
crate::harness::overlay(&self.roles, &self.tiers, crate::harness::routing().as_ref())
}

/// Which layer decided one role's candidates.
///
/// The headline source on `resolve_roles` cannot answer this when an operator
Expand All @@ -803,6 +825,10 @@ impl AdminConfig {
.is_empty()
{
Source::Environment
} else if crate::harness::routing()
.is_some_and(|h| h.roles.get(role).is_some_and(|m| !m.is_empty()))
{
Source::Harness
} else if self.roles.get(role).is_some_and(|m| !m.is_empty()) {
Source::AdminFile
} else {
Expand Down
Loading
Loading