King Sejong is an all-in-one skill bundle for Codex and Codex-style agent environments. It can be installed repo-locally or into a Codex user skill directory.
It is designed for maintainers who use Codex on real repositories: pull request review, issue triage, release preparation, installer checks, security guardrails, documentation consistency, and other open-source maintenance workflows where an agent should gather evidence before it edits.
It gives an agent one broad front door, $sejong, for moving from research to decision, planning, execution, verification, and evidence recording.
After $sejong is invoked, follow-up turns stay in the active Sejong workflow until the user explicitly exits Sejong or switches to another non-Sejong workflow.
Uigwe is the formal planning protocol behind that front door. Sejong routes into Uigwe only when a durable planning bundle is useful, then continues to execution and verification when the user asked for an outcome rather than a plan artifact.
Uigwe decomposes plans by repeatedly selecting candidate work, reviewing whether it satisfies the parent goal, reselecting when it does not, and descending until each branch becomes a consumer-ready executable leaf.
This is not a standalone CLI or Python package. It is meant to be copied into a target repository or into ${CODEX_HOME:-~/.codex}/skills so Codex can load the installed skill files.
By default, Sejong keeps research, planning, runtime, and evidence artifacts outside the target repository under ${SEJONG_HOME:-${CODEX_HOME:-~/.codex}/sejong}. It does not create git-tracked planning files unless the user explicitly asks to promote a shareable artifact into the repo.
King Sejong is early, but it is built around repeatable maintainer work rather than a demo-only agent loop:
- review a change with evidence, rationale, and verification expectations before editing
- triage issues into research, decision, planning, execution, or rejected-option paths
- turn approved designs into executable leaves with Seungjeongwon verification
- validate install surfaces, hooks, schemas, examples, and instruction contracts before release
- keep runtime artifacts outside the target repository unless a maintainer asks to promote a tracked record
See OSS maintainer workflows for concrete examples.
Use Sejong.
Do not write SeJong. The conventional romanization is Sejong, as in King Sejong.
Recommended names:
- Human-facing product name:
King Sejong - Skill name:
sejong - Invocation:
$sejong - Repository slug:
king-sejong
For the current repository:
tmp=$(mktemp -d)
git clone --depth 1 https://github.com/JoonSCode/king-sejong.git "$tmp/king-sejong"
bash "$tmp/king-sejong/scripts/install-sejong.sh" "$PWD"
bash "$tmp/king-sejong/scripts/install-sejong.sh" --verify "$PWD"
rm -rf "$tmp"Agent-assisted install prompt:
Install King Sejong into this repository from https://github.com/JoonSCode/king-sejong.
Run scripts/install-sejong.sh against the current repo, then verify the install with --verify.
For Codex user scope, available from any workspace:
tmp=$(mktemp -d)
git clone --depth 1 https://github.com/JoonSCode/king-sejong.git "$tmp/king-sejong"
bash "$tmp/king-sejong/scripts/install-sejong.sh" --scope user
bash "$tmp/king-sejong/scripts/install-sejong.sh" --scope user --verify
rm -rf "$tmp"User-scope install also writes a managed King Sejong guidance block to ${CODEX_HOME:-~/.codex}/AGENTS.md by default. That keeps Sejong available as an always-on research, analysis, debate, planning, execution, and verification discipline across Codex workspaces. Use --codex-guidance none if you only want the skills, hooks, and active context.
Clone this repository, then install the bundle into the repository where you want to use it:
git clone https://github.com/JoonSCode/king-sejong.git
cd king-sejong
bash scripts/install-sejong.sh /path/to/your-repoTo replace an existing install:
bash scripts/install-sejong.sh --force /path/to/your-repoTo check an existing install without copying files:
bash scripts/install-sejong.sh --verify /path/to/your-repoTo check whether your King Sejong source checkout has upstream updates:
bash scripts/install-sejong.sh --check-updatesTo fast-forward the King Sejong source checkout and refresh the Codex user-scope install:
bash scripts/install-sejong.sh --auto-update --scope user--auto-update refuses dirty or diverged source checkouts, uses git pull --ff-only, then refreshes the selected managed install with force semantics and normal verification. King Sejong hooks do not silently self-update during ordinary sessions.
To install into the current Codex user scope instead:
bash scripts/install-sejong.sh --scope user
bash scripts/install-sejong.sh --scope user --verifySet CODEX_HOME first if your Codex home is not ~/.codex.
Use bash scripts/install-sejong.sh --scope user --codex-guidance none to skip the managed ${CODEX_HOME:-~/.codex}/AGENTS.md guidance block.
Repo scope copies these managed paths into the target repository:
.agents/skills/sejong/.agents/skills/jangyeongsil/.agents/skills/jiphyeonjeon/.agents/skills/uigwe/.agents/skills/seungjeongwon/.agents/skills/why-gate/docs/sejong/
User scope copies these managed paths into ${CODEX_HOME:-~/.codex}/skills:
sejong/jangyeongsil/jiphyeonjeon/uigwe/seungjeongwon/why-gate/
In user scope, shared Sejong docs are installed under skills/sejong/docs/, and the installed skill files are rewritten to load those docs from the user skill tree.
User scope also copies the Codex plugin adapter to ${CODEX_HOME:-~/.codex}/plugins/cache/king-sejong-local/king-sejong/0.1.0/ and enables it through a marked King Sejong plugin block in ${CODEX_HOME:-~/.codex}/config.toml.
That plugin hook is the canonical user-scope hook source. Reinstalling user scope removes the older marked direct hook block by default; use --legacy-direct-hooks only as an explicit fallback and never together with the plugin hook.
Keep each scope's managed paths together. The skills are intentionally small and load their routing, planning, schema, and handoff contracts from the installed Sejong docs. The plugin adapter is hook metadata only, so the user-facing skill remains $sejong.
King Sejong is distributed as Codex skills with a thin Codex plugin adapter, not as an npm package, Python package, or standalone CLI.
| Host | Support | Notes |
|---|---|---|
Codex with repo-local .agents/skills |
Supported | Primary target for repository-specific use. |
Codex with user-scope ${CODEX_HOME:-~/.codex}/skills plus the local plugin cache |
Supported | Use when you want $sejong, $jangyeongsil, $jiphyeonjeon, $uigwe, and $seungjeongwon available across workspaces with plugin hook metadata. |
Codex-style hosts that read .agents/skills and repo docs |
Possible | Install the same managed paths and verify behavior in that host. |
| OpenCode, Claude Code, Gemini CLI, Cursor | Not packaged yet | Their plugin/extension formats need separate adapters. |
If you use several agent harnesses, install King Sejong separately for each harness once an adapter exists.
This package is explicitly for Codex-style skills:
- In repo scope, Codex loads
.agents/skills/sejong/SKILL.mdfor$sejong. - In user scope, Codex loads
${CODEX_HOME:-~/.codex}/skills/sejong/SKILL.mdfor$sejong. - The
king-sejongplugin exposes hook metadata only; it does not add a second plugin-scoped$sejongskill. - The same scope contains
$jangyeongsil,$jiphyeonjeon,$uigwe, and$seungjeongwon. - Codex can execute clear tasks directly through Sejong when formal planning is not needed.
- The docs include Codex consumer contracts for downstream execution feedback.
Execution is part of Sejong's job, and King Sejong includes its own executor:
Seungjeongwon/승정원
Seungjeongwon is King Sejong's native execution loop. It executes approved scopes or validated Uigwe bundles, verifies the result, and reports evidence.
Sejong can finish work in two ways:
- direct execution in the current Codex session when the task is clear enough
- native Seungjeongwon execution when a plan or bundle needs implementation and verification
What is included:
- direct execution for clear implementation and verification work
- recursive Uigwe decomposition that keeps selected leaves tied to the parent goal and verification criteria
Seungjeongwonnative executor skill- Seungjeongwon execution contract
- Why Gate rationale checkpoints for reviews, planning choices, retrospectives, and self-audits
- repo-context
AGENTS.mdinit/refresh contract with candidate diffs - schema, bundle, and instruction-surface validation helpers
- install and verify script for managed repo-local and Codex user-scope paths
What is not included:
- a guarantee that non-Codex hosts understand the handoff automatically
- an always-on automatic updater for repository instruction files
- adapters for OpenCode, Claude Code, Gemini CLI, or Cursor
Sejong can run the full arc when the user asks for an outcome:
JangYeongsil research -> Jiphyeonjeon discussion -> Uigwe planning -> Seungjeongwon execution -> verification -> Sillok evidence
It should only stop early when the next step truly needs missing evidence, a user decision, or an approval gate.
Use Sejong when the right workflow is not obvious yet:
$sejong research this and tell me whether it should become a plan
$sejong discuss these options and recommend the next surface
$sejong turn this approved design into executable work
Use Uigwe directly when you already know you want formal planning:
$uigwe full build a browser-based MVP for async interview practice
$uigwe design-to-plan this feature brief
$uigwe decompose-only docs/specs/approved-design.md
| Surface | Use When | Output |
|---|---|---|
JangYeongsil / 장영실 |
The facts, history, or evidence are still unclear. | Known facts, inferences, unknowns, next decision. |
Jiphyeonjeon / 집현전 |
The main job is discussing options and choosing a direction. | Arguments for and against, rejected paths, recommendation, risks. |
Uigwe / 의궤 |
A durable planning bundle is useful. | Uigwe packets, spec.md, rationale.md, goal-tree.json. |
Seungjeongwon / 승정원 |
A validated scope or bundle needs execution. | Execution, verification, and feedback. |
Sillok / 실록 |
Evidence should be preserved. | Scorecards, promotion notes, decision history. |
Danjong / 단종 |
An option should be rejected or retired. | Rejected-option record. |
Sejong direct |
The task is clear enough to do now. | Completed work plus verification evidence. |
Court-inspired names are supported as user-facing language:
JangYeongsil-> researchJiphyeonjeon-> discussion, debate, and decision supportUigwe-> formal planningSeungjeongwon-> executionSillok-> evidence recordsDanjong-> rejected or retired options
Use JangYeongsil when evidence is missing, Jiphyeonjeon when evidence exists but the team needs discussion, and Uigwe when the selected direction should become a formal plan.
Jiphyeonjeon is optional. It should appear as a short council pass only when evidence leaves a meaningful choice; skip it when the direction is already clear enough for Uigwe, Seungjeongwon, or direct action.
Bounded workers can increase parallelism for independent research branches, option reviews, implementation slices, or verification lanes. Codex native subagents are one backend; $team tmux workers are another. They are not a required step; the lead Sejong agent still owns synthesis, routing, and final verification.
For larger Sejong runs, use research fan-out in JangYeongsil, bounded council briefs in Jiphyeonjeon, and only preflight checks in Uigwe before approval gates. Substantial Jiphyeonjeon decisions may use $team tmux workers coordinated through Sejong mailbox/state files under ${SEJONG_HOME:-${CODEX_HOME:-~/.codex}/sejong}/state/team/<run-id>/. Worker or subagent agreement is never evidence, approval, or verification by itself.
No .codex/prompts/{role}.md files are required. King Sejong uses Codex native role prompts by default and treats repo-local prompt files as optional overlays when a target repo provides them.
When changing King Sejong itself, material behavior changes should follow the full Sejong chain: Jiphyeonjeon decision support, Uigwe planning and decomposition, then Seungjeongwon implementation and verification. Use direct edits only for non-behavioral typo, link, formatting, or mechanical fixes.
- Sejong router contract
- Repo context init and refresh
- Artifact storage
- Team executor
- Workflow-run dynamic workflow evidence contract
- OSS maintainer workflows
- Prompt overlays
- Uigwe protocol
- Uigwe wrapper
- Seungjeongwon executor
- Bundle validator
MIT. This keeps installation and reuse low-friction for personal, internal, and public agent workflows.
