Constrained Modeling for Coding Agents

dannylee10201 pts0 comments

GitHub - dannylee1020/kkt: Start modeling your implementation · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

dannylee1020

kkt

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>5 Commits<br>5 Commits

assets

assets

bin

bin

scripts

scripts

skills

skills

.gitignore

.gitignore

LICENSE

LICENSE

README.md

README.md

package.json

package.json

View all files

Repository files navigation

Start modeling your implementation

=22" src="https://camo.githubusercontent.com/874f0ed2bdb39003c6704b41ba7311588f270527db0784688d7d84728108d39c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6e6f64652d25334525334432322d6639373331362e737667" data-canonical-src="https://img.shields.io/badge/node-%3E%3D22-f97316.svg" style="max-width: 100%;">

kkt applies constrained optimization to coding-agent workflows. Named after the Karush-Kuhn-Tucker conditions, it translates mathematical modeling discipline into a practical framework for identifying application constraints, choosing feasible implementation paths, and validating the result.

Why kkt

Good implementation plans are shaped as much by what not to do as by what to do.

kkt makes those limits explicit. Before choosing an implementation path, it pushes the agent to identify the constraints that define a safe change: public contracts that must not break, architecture boundaries that must not be crossed, data rules that must not be weakened, and validation that must not be skipped.

Instead of:

build xyz

model the work as:

what is the optimized implementation,<br>given what must stay true?

The result is a more disciplined implementation plan: fewer accidental side effects, clearer tradeoffs, smaller edits, and validation tied to the actual constraints of the work.

For coding agents, those constraints are usually concrete:

existing architecture and public contracts

files, modules, endpoints, schemas, and migrations

security, privacy, and data-integrity rules

ui and product boundaries

infrastructure and runtime limits

validation evidence required to prove completion

The core idea:

choose<br>x in X

maximize<br>alignment(user_goal, x)

subject to<br>C_app(x)<br>C_arch(x)<br>C_data(x)<br>C_ui(x)<br>C_infra(x)<br>C_validation(x)

where:

x is the implementation decision vector

X is the feasible implementation region

C_* are application constraints

the selected plan is the best feasible plan, not the first plausible plan

validation is the certificate that the selected plan satisfies the model

Install

Install with curl:

curl -fsSL https://raw.githubusercontent.com/dannylee1020/kkt/main/scripts/install.sh | bash

By default, this installs the skills for Codex, Claude Code, Pi, and OpenCode using their shared skill locations:

~/.agents/skills<br>~/.claude/skills

Target-specific paths are also available for agents that prefer their own skill directory:

Codex: ~/.agents/skills<br>Claude Code: ~/.claude/skills<br>Pi: ~/.pi/agent/skills<br>OpenCode: ~/.config/opencode/skills

Useful options:

--target codex<br>--target claude<br>--target pi<br>--target opencode<br>--local<br>--dry-run

From a checkout:

scripts/install.sh

Quick Start

Use the skill syntax supported by your agent:

Codex: $kkt<br>Claude Code: /kkt<br>Pi: /skill:kkt<br>OpenCode: ask OpenCode to use the kkt skill

Start with a rough request:

Use $kkt to add export-to-csv for reports.

Add constraints only when you already know them:

Use $kkt to add export-to-csv for reports.

Constraints:<br>- Reuse the existing reports api.<br>- Do not change billing code.<br>- Do not add dependencies.

Validation:<br>- Add or update the smallest useful test.<br>- Run the relevant test command if available.

kkt should inspect the repo, infer discoverable constraints, and ask only for decisions that materially affect feasibility, product behavior, risk, or execution mode.

How It Works

Default agent flow:

plausible plan<br>-> edits<br>-> summary">user request<br>-> plausible plan<br>-> edits<br>-> summary

with kkt:

request intake<br>-> constraint discovery<br>-> feasible region<br>->...

implementation skills constraints plan must claude

Related Articles