Requirements#

What this project must do, the conditions it works under, and what it deliberately does not do. Each requirement says where it is verified, so a change that breaks one fails a test, not a user.

Purpose#

Give an organisation one command-line core for every repository, which each repository extends with its own commands, and distribute agent skills to every repository and every coding-agent harness from three origins: the organisation’s shared skills, allow-listed vendors, and the repository’s own. People, CI and AI agents use the same commands.

Functional requirements#

The launcher#

ID

Requirement

Verified by

F1

graftkit finds the nearest graftkit.toml at or above the working folder (or --root, GRAFTKIT_ROOT); outside any root, only the global commands run.

test_finds_nearest_root_from_a_subfolder, test_explicit_root_wins_over_environment, test_outside_a_root_runs_the_global_commands

F2

A root pinning [cli] core runs exactly that version from PyPI through uvx; a root with an extension runs in its own environment through uv run; a delegated run never delegates again.

test_core_root_pinned_elsewhere_delegates_to_uvx, test_extension_root_delegates_to_its_environment, test_never_delegates_twice

F3

A broken graftkit.toml or extension does not stop the core: its commands, doctor included, still run and report the problem.

test_invalid_config_runs_here_with_a_warning, test_broken_extension, test_doctor_fails_on_a_broken_root

F27

A root pinning a core older than the installed one, whose run rejects the command or an option, is told how to move the pin.

test_an_older_pin_that_rejects_the_command_says_how_to_move_it, test_no_pin_hint_unless_an_older_pin_rejects_the_usage

F28

The installed graftkit works in every place it is run: outside any root, at a root and in its subfolders, in an extension root (through uv run), in a root pinning an older core (through uvx), and in the folder that holds the clones.

test_each_place_a_command_runs_in, test_describe_finds_the_root_from_anywhere_in_it, test_an_extension_root_runs_through_uv_in_its_own_environment, test_an_older_pin_runs_through_uvx_with_that_version, test_a_root_pinned_to_this_version_delegates_nowhere, test_the_umbrella_folder_keeps_the_clones_it_has

Extensions and the command standard#

ID

Requirement

Verified by

F4

A repository adds commands as an Extension entry point named in [cli] extension; its commands receive the Repo, never compute the root.

test_extension_commands_receive_the_repo, test_from_package_collects_one_command_per_module

F5

Every command, core and extension, follows one mechanical standard (names, help texts, module per command, annotations, an example on every command an agent may run), checked by extension check, doctor and each extension’s tests; the extension new scaffold follows it.

test_core_commands_follow_the_standard, test_rules, test_an_example_is_optional_on_a_hand_off_command_or_a_group, test_extension_check, test_extension_new_scaffolds_a_working_conformant_extension

F6

extension new scaffolds a working extension that passes its own tests and the standard, and changes nothing if any file exists or pyproject.toml is unusable.

test_extension_new_scaffolds_a_working_conformant_extension, test_extension_new_checks_pyproject_before_writing

Skills#

ID

Requirement

Verified by

F7

Every skill lives in .agents/skills/<name>; each harness that does not read that folder gets one relative link per skill, and stray entries are reported, never touched.

test_create_then_in_step, test_native_harnesses_need_no_links, test_strays_are_reported_not_touched

F8

Only skills a lock entry owns are written or deleted; a folder the lock does not own is the repository’s own and is never overwritten; a managed skill edited by hand is replaced only with --force.

test_add_remove_and_local_skills_survive, test_local_skill_with_a_source_name_is_never_overwritten, test_drift_is_caught_and_only_force_replaces_edits

F9

Vendor skills come only from the content release’s allow-list; bundled ones must match the commit and content hash the release reviewed, so a moved tag or changed content fails before anything is written.

test_resolution_errors, test_moved_tag_fails, test_changed_content_fails

F10

skills sync --check is offline and fails on a stale lock, drifted skills, pending links, an out-of-date generated skill or invalid local skills.

test_sync_installs_locks_links_and_then_checks_offline, test_stale_lock_fails_check, test_check_notices_changed_commands_and_sync_rebuilds_offline

F11

Editing the sources (add, remove, update) resolves and plans before writing; a failure leaves graftkit.toml unchanged. update --pr leaves the checkout as it was if anything fails.

test_invalid_edit_restores_the_file, test_a_failed_change_leaves_the_checkout_as_it_was

F12

In the content repository, skills review pins every bundled vendor skill in vendors.lock and checks the release; skills promote proposes a skill to it as a pull request that would pass review.

test_review_pins_bundled_vendor_skills, test_promote_a_local_skill, test_promote_a_vendor_skill

Agents#

ID

Requirement

Verified by

F13

describe --json lists every command of the root, core and extension, with its agent policy and what its --describe prints (examples, options, questions), as a versioned document.

test_describe_matches_the_snapshot, test_describe_json_lists_core_and_extension_commands

F14

A command is hand-off unless it declares graftkit.agent = "run"; an unknown graftkit.* annotation or value breaks the standard.

test_policy_defaults_to_hand_off, test_conformance_rejects_bad_annotations

F15

skills sync writes the generated graftkit skill from the root’s commands, rebuilds it offline when they change, and never mistakes it for, or overwrites, a local skill.

test_sync_generates_a_skill_of_the_root_commands, test_a_local_skill_with_the_generated_name_is_refused, test_the_generated_skill_matches_the_snapshot

F30

The core commands declare examples, and <command> --describe prints that command’s examples, options and questions; the generated skill sends agents to --describe for one command, not to the whole describe --json.

test_describe_json_lists_core_and_extension_commands, test_new_describe_document, test_the_generated_skill_matches_the_snapshot

The organisation#

ID

Requirement

Verified by

F16

org repos lists the organisation’s repositories the person’s gh login can see, with their access, from GitHub’s own permissions; graftkit keeps no permission model. An answer GitHub gives that graftkit does not understand fails loudly, as do a repository name that is not one (such as ..) and a page that says more follow but not where.

test_repos_lists_what_the_person_can_see, test_organisation_repositories_page_through_graphql, test_an_unexpected_organisation_answer_fails_loudly, test_a_repository_name_that_is_not_one_fails_loudly, test_a_page_that_says_more_follow_but_not_where_fails_loudly

F17

org map shows each visible repository that is not archived, with its README’s ## For agents section and the commands its generated skill lists, read at the head of its default branch; a file GitHub returns only in part fails loudly. Only the map reads the files, so the other org commands never fail on them. The generated skill points agents to org map --json.

test_map_reads_each_repository_s_readme_and_generated_skill, test_files_are_left_out_unless_asked_for, test_the_command_table_reads_back_exactly, test_for_agents_ignores_a_heading_inside_a_code_block, test_a_file_github_cut_short_fails_loudly, test_the_generated_skill_matches_the_snapshot

F18

org search searches the organisation’s code through gh search code, so it finds only what the person can read; --repo narrows it to one repository, --limit caps it, and an invalid value of either is a usage error naming the value. An answer that does not parse, or a refusal such as a rate limit, fails loudly with the command and the reason.

test_search_finds_text_in_the_repositories_the_person_can_read, test_search_code_runs_gh_search_and_reads_its_answer, test_search_refuses_an_invalid_option, test_a_failed_search_says_which_command_and_why, test_a_search_answer_that_does_not_parse_fails_loudly

F19

org clone clones, through gh, every visible repository that is not archived and is missing from the folder, and sets the git_name/git_email identity, when set, as part of each clone, so no clone exists without it. A failed clone stops the command with git’s reason, after saying what it did clone; running it again continues.

test_clone_adds_what_is_missing_with_the_identity, test_clone_keeps_git_s_identity_when_none_is_set, test_a_failed_clone_stops_and_says_why_and_running_it_again_continues, test_clone_sets_the_config_as_it_clones

F20

org sync fast-forwards every clean clone in the folder and changes nothing else: a clone with local changes (untracked files included), one that cannot fast-forward, one whose configured origin is not the repository (any URL form of it counts), one not on the default branch, an empty repository or a folder that is not a clone is skipped with the reason, and a repository with no clone is listed.

test_sync_fast_forwards_clean_clones_and_says_why_it_skipped_others, test_sync_leaves_a_diverged_clone_alone, test_sync_leaves_a_clone_of_another_repository_alone, test_sync_accepts_every_form_of_the_origin_url, test_sync_leaves_a_clone_off_its_default_branch_alone, test_origin_branch_and_cleanliness, test_fast_forward_says_whether_it_moved, test_fast_forward_refuses_a_diverged_clone

F29

org clone and org sync refuse a folder inside a checkout or a root, or one that is a repository itself, before asking GitHub anything or showing progress, so clones never nest in a repository; the error suggests a folder of their own.

test_clone_and_sync_refuse_a_folder_inside_a_repository, test_a_repository_itself_is_named_as_one, test_each_place_a_command_runs_in

F21

Opening a pull request (skills promote, skills update --pr) first asks GitHub for the person’s access to the target repository and, below WRITE, fails before anything is cloned, branched or edited, naming the repository and the access needed.

test_proposing_without_write_access_fails_before_anything_is_written, test_write_access_or_more_may_propose, test_an_access_answer_that_does_not_parse_fails_loudly

F22

doctor warns, without failing, when a root’s README lacks the ## For agents section or its three bullets (Provides, Concepts, Entry points, in that order and nothing else).

test_doctor_warns_about_a_readme_without_the_for_agents_section, test_a_readme_that_departs_from_the_convention_says_how, test_a_readme_with_the_three_bullets_follows_the_convention

Settings#

ID

Requirement

Verified by

F23

config asks one question per setting, derived from the Settings model (help from the field’s description, the model as the validator), and writes the answers that change something to the user config, or with --in-root to the root’s [settings], keeping comments and layout. Each question defaults to the value in the layer being written; an invalid value is refused and nothing is written.

test_every_setting_is_asked_from_its_field, test_config_writes_the_user_config_and_keeps_its_comments, test_config_with_root_writes_the_root_s_settings, test_each_question_defaults_to_the_value_in_the_layer_written, test_config_refuses_a_value_the_setting_does_not_allow

F24

config show reports every setting, its value and the layer it came from, by the same code that merges the layers; config says when a later layer still overrides a value it wrote.

test_show_says_which_layer_each_value_comes_from, test_config_says_when_a_later_layer_still_overrides, test_layers_override_in_order

F25

config unset removes a value from one layer, and says when it was not set there; a missing setting’s error points to config.

test_unset_removes_a_value_from_one_layer, test_require_says_how_to_set_it

F26

Settings are read when a command needs them, by one loader for every layer: an invalid value fails that command once, naming the setting, its value and where it is set, and a file that does not read fails with its path; commands that need no settings still run, and doctor reports the problem.

test_invalid_layers, test_an_invalid_organisation_setting_is_refused, test_a_bad_user_config_fails_only_the_commands_that_read_settings, test_doctor_fails_on_an_invalid_setting

Non-functional requirements#

ID

Requirement

Verified by

N1

Works on macOS, Linux and Windows; Python 3.11 and newer.

CI matrix (3 OSes × Python 3.11, 3.14)

N2

The declared dependency lower bounds work, not just the locked versions.

CI test-lowest

N3

Five runtime dependencies only: cli-interview-kit, packaging, pydantic, pyyaml and tomlkit. Another needs a strong case.

Review (pyproject.toml)

N4

GitHub is reached only through the GitHub CLI; graftkit never reads, stores or prints a token.

test_answers_through_gh_api, review

N5

The package builds, renders on PyPI and imports from a clean environment; it is typed (py.typed).

CI build (twine check --strict)

N6

95% or more test coverage; warnings in tests are errors.

CI test

N7

mypy --strict passes on the source and the tests; workflows pass actionlint and zizmor; actions are pinned to commit SHAs.

CI lint

N8

The API reference is generated from the docstrings, builds without warnings, and lists every public name; the source, the scaffold templates and the tests follow the docstring and comment rules, and every pydantic field is described.

CI docs, tests/test_api_reference.py, tests/test_docstrings.py

Environment and constraints#

  • Tools: uv runs pinned versions and extensions; git and the GitHub CLI (gh auth login) are needed for skills from GitHub and for pull requests. graftkit doctor checks all three.

  • Harnesses: any harness that reads .agents/skills, or one listed in the harness table, which links each skill where it reads. Agents need only a shell to use --describe and describe --json.

  • Windows: skill links are symbolic links, so Windows needs core.symlinks (developer mode).

  • Repository rules (managed outside this repo): a code owner must approve every pull request, merges are squash-only, ci-required must pass, and tags matching v* are protected. Releases are tags on main, published to PyPI and as a GitHub Release (see CONTRIBUTING.md).

Out of scope#

Nested roots (one graftkit.toml per repository); skill hosts other than GitHub; extensions in languages other than Python; user-level skill installs (~/.agents/skills); a harness plugin marketplace. Each can be proposed in an issue.

Verification status#

Every requirement above is covered by the test suite and CI. GitHub is replaced by an in-memory fake (graftkit.testing.FakeGitHub) in the tests; the real gh and git calls are tested against a local repository, and skills review was also run against the real vendor repositories.