Stability promise¶
Karni is a dependency you upgrade, not a template you copy, so what may change, and when, is part of its design. This page defines what counts as public API and what Karni promises about it.
Versioning¶
Karni uses semantic versioning, starting at 0.1.0.
Every published package moves in lockstep: one release tag publishes
karni, karni-cli, @karni/ui and every module's Python package and
React package (when it has one) at the same version
(the list).
| Release | May contain |
|---|---|
Patch (0.2.1) |
Bug and security fixes only. No public API change, no new deprecation. |
Minor (0.3.0) |
New features and deprecations. Before 1.0, also breaking changes, always under the rules below. |
Major (1.0.0, 2.0.0) |
Removal of anything deprecated in an earlier minor. |
The promise¶
For everything listed as public below, except the names marked experimental:
- Nothing breaks without warning. A public name is deprecated for at
least one minor release before it is removed. While deprecated, it keeps
working and raises a
KarniDeprecationWarning. The warning names the release that removes it and links the migration note. Removal happens in the next major release. This applies in 0.x as well: the names 0.2 deprecates are removed in 1.0, not in 0.3. - Every breaking change is recorded. Each one is an entry in Karni's
machine-readable changelog (
karni/changelog/<version>.toml) and has a section in the migration notes (0.5, 0.4, 0.3, 0.2, 1.0). - Mechanical changes are applied for you. When a change can be made
safely by rewriting code (a renamed import, setting, base class or method),
it ships with a codemod.
karni upgrade --to <version>runs every codemod between your version and the target, shows the diff (--dry-run), and lists what it could not change, with file and line. - Security fixes reach the latest minor release. The supported versions are listed in Security.
A rare exception: if a security fix cannot be made without breaking a public API, the fix ships anyway. The release notes and the migration note say so, and a codemod or detector is included where possible.
What is public API¶
Python (karni, karni-payments)¶
- Every name in a module's
__all__, imported from the module that declares it: for examplekarni.models.BaseModel,karni.api.access.Owned,karni.testing.assert_crudandkarni.seeding.Seeder. Names not in__all__are internal, even when importable. - Documented overridable methods and attributes of public classes,
meaning the escape hatches named in their docstrings and in the docs
(
get_querysethooks,access,optimize,Metaoptions, seederseed(), and so on). Their signatures are public. - Settings: every documented
KARNI_*setting, its meaning and its default. Changing a default is a breaking change. - Project file conventions Karni discovers by name:
<app>/listeners.py,<app>/events.py,<app>/schedules.py,<app>/seeds.py,<app>/factories.py,<app>/tasks.py. - Entry-point groups:
karni.settings(module settings fragments),karni.checks(architecture checks) andkarni.history_providers(agent history providers), plus thepytest11plugin. - The REST API contract Karni generates: URL shapes, the query
parameters (
?expand=,?search=, filters, ordering,page,page_size), response envelopes and status codes, including the 404 out-of-scope and 403 read-but-not-write rule ofaccess. - Error codes. A code (for example
E012) keeps its meaning forever. Codes are never renumbered or reused. Message wording may improve in any release, so match on the code, not the text. - Database schema of Karni's own models (accounts, module models). Changes always come with a migration.
TypeScript (@karni/ui, @karni/payments-ui)¶
- Everything exported from the package root (
@karni/ui): components, their documented props, hooks and types. - The subpath exports in
package.json:@karni/ui/styles.css,@karni/ui/tailwind-preset,@karni/ui/tailwind-v4.css,@karni/ui/eslint-pluginand@karni/ui/manifest.json. - ESLint rule ids (
karni/no-raw-elements, …) and what each forbids. - Deep imports (
@karni/ui/dist/...,src/...) are internal, and the ESLint plugin flags them.
The karni command (karni-cli)¶
- Command names, arguments and flags, as listed in the CLI
reference.
karni make:<type>aliases are public too. - Machine-readable output (
--json,karni context,karni rules,karni routes --json). Fields are only added, never renamed or removed, within a major release. - Exit codes: 0 for success, and non-zero for failure with the reason on stderr.
- The files
karni makegenerates and their layout, because projects and agents rely on where code goes. The generated content may improve. karni_clias a Python import is internal. Only the command line is public.
Agent guidance¶
- Rule codes (
K001, …) and what each enforces. - AGENTS.md, the agent file
karni rules syncwrites, and the procedures it lists. Its wording changes between releases, so runkarni rules syncafter upgrading. - Deprecated in 0.5.0, removed in 1.0: the files that only one tool reads,
which
karni newwrote before 0.5.0 (CLAUDE.md,.claude/commands/,.cursor/rules/karni.mdc,.cursor/commands/,.windsurf/rules/karni.md,.windsurf/workflows/,.github/copilot-instructions.md,.github/prompts/,.clinerules/karni.md,.junie/AGENTS.mdandCONVENTIONS.md).karni rules synckeeps a project's existing ones up to date until then and warns withC860(migrating).
What is internal¶
- Anything whose name starts with
_: modules, functions, attributes. - Anything not in
__all__, not documented, or documented as internal. karni.agentinternals other than the history-provider interface (karni.agent.history).- Test-suite helpers inside Karni's own repository (
tests/packages). - The exact SQL Karni emits, query counts (query budgets are public), log message wording, and admin template markup.
- The scaffold's templates (
templates/project/). They generate your files, and changing them never changes an existing project. Project-level migrations, where needed, ship askarni upgradecodemods.
Experimental names¶
A new public name can ship as experimental first. An experimental name is public and documented, but it may change or be removed in a minor release without the deprecation cycle above. Every such change is noted in the CHANGELOG and in the migration notes of that release, so an upgrade never changes one silently.
A name is experimental only when it is marked, and the mark is visible wherever you meet the name:
- its docstring (Python) or doc comment (TypeScript) starts with
Experimental., - the docs section that describes it opens with an Experimental note,
- its capability in the reference
has the status
experimentaland says Experimental tier. The statusexperimentalalone only means that no reference application uses the capability yet: those names keep the promise.
Some parts never become experimental. An error code keeps its meaning forever and is never reused, also for an experimental feature. A change to the database schema of an experimental model always comes with a migration.
An experimental name becomes stable in a minor release, once a reference application uses it. The CHANGELOG entry of that release says so, and from then on the promise above applies in full.
Experimental now:
- Sign-in with an ID token (Google, Microsoft, Apple):
the
social/<provider>/endpoint, theKARNI_SOCIAL_TOKEN_*settings,karni.accounts.social_token, theSocialIdentitymodel, anduseSocialLoginandSocialButtonin@karni/ui. - Sign-in with a code sent by email:
the
otp/send/andotp/verify/endpoints, theKARNI_EMAIL_OTP*settings, theauth.otp_*throttle scopes,karni.accounts.otp, theLoginCodemodel,karni.accounts.services.prove_address, anduseOtpLogin,OtpLoginFormandLoginForm'scodeSignInin@karni/ui. - Terms acceptance: the
terms/andterms/accept/endpoints, theKARNI_TERMSsetting,karni.accounts.terms(withTermsGateMiddleware), theTermsAcceptancemodel, thetermsfield ofme/, the client'sonErrorhook, andTermsGateanduseAuth()'sterms,termsRequiredandacceptTermsin@karni/ui. - Demo mode:
karni.demo(its accounts, write rule, reset, middlewares,manage.py karni_demo_boot,GET /api/demo/andapp_urls()), theKARNI_DEMO_*settings,karni.E950toE954, andDemoNotice,DemoSignInPrompt,useDemoandkarniKeys.demoin@karni/ui. - Integer primary keys:
karni.models.BigIntBaseModelandIntegerKeyModel, theKARNI_PKsetting,karni make model --pk,karni.api.filters.IntegerFilter, the import optionsmatch_idsandkeep_ids(with theImportJobfields of the same names), and theKEYS:line ofkarni context. - The
API:line ofkarni context(karni.introspect.api_section): how a list pages, read from the project's paginator. - External tables, views and a second database:
the
class Karnioptionsexternal,writableanddatabase,karni.db(withDatabaseRouter,karni.db.checksandkarni.db.introspection),BaseViewSet.is_read_onlyandread_only_refused_actions,KarniModelAdmin.is_read_only,assert_crud'sread_only,karni.testing.create_external_tables, the pytest option--karni-external-tables,manage.py karni_inspectandkarni make model --external. - Per-user grants: the
KARNI_USER_GRANTSsetting, theUserGrantmodel,karni.accounts.grants, thetargetsandgrant_idofkarni.accounts.roles.Grantand the user-grant fields ofGrantSourceand of the effective permissions, thepermissions/grants/endpoints, the grants inline and admin (karni.accounts.admin.grant_form), andfeatures: user_grantsinkarni.yaml. - Search across models: the
class Karnioptionsearch,karni.global_search,karni.api.global_search(withGlobalSearchView,search_queryset,search_targetsand theTITLE,SUBTITLEandSCOREannotations), theGET /api/search/endpoint and its response,BaseViewSet.global_search_queryset,karni.fields.TrigramIndex, theKARNI_GLOBAL_SEARCH_*settings, thex-karni-searchschema extension, the entity keyglobal_searchofkarni.yaml,SearchResourceand the typeduseGlobalSearchofkarni types, andGlobalSearch,useGlobalSearch,karniKeys.searchandLayout'ssearchin@karni/ui. - The app spec: the
karni.yamlformat and its JSON Schema,karni spec validate,karni spec export,manage.py karni_facts,karni.factsand thekarni_cli.specpackage. - Clarifying questions:
karni plan --questions(its--max, its--jsonoutput and schema, the question ids and the rules that choose them),karni spec answer,karni_cli.spec.questionsandkarni_cli.spec.edit. karni build: the command, its--jsonoutput and schema, the layout of the files it writes (<app>/karni/,<app>/tests/karni/,frontend/src/pages/karni/, thekarni:specblocks),.karni/build.json,manage.py karni_makemigrationsand thekarni_cli.builderpackage.- Aggregations:
class Karni: aggregate, the viewset'saggregation,get_aggregation()andaggregate_queryset(), theaggregateaction, its parameters and response,karni.aggregation(withAggregation,TextNumberandrun_aggregate),karni.api.aggregate,x-karni-aggregate, theKARNI_AGGREGATE_MAX_GROUPSsetting,karni.testing.performance.aggregate_query, theuse<Resource>Aggregatehookskarni typeswrites, anduseAggregate,aggregateKey,buildAggregateQuery,aggregateSeriesand DataChart'saggregateandstackedin@karni/ui. - Saved charts: the karni-charts module (the
Chartmodel and its admin,/api/charts/and itsdataaction,karni_charts.services,KARNI_CHARTS_READ, theCHARTcodes' wording) and@karni/charts-ui(SavedChart,useSavedChart,savedChartKey,savedChartQuery). - Page blocks:
DashboardGrid,DashboardCard,ChartCard,DataTable,ComparisonTable,Accordion,MarkdownView(withpreloadMarkdown),useResourceCounts, their slots, props and types, ResourceDetail'srelatedprop andRelatedslot, theRelatedDefschema type, the--karni-dashboard-gap,--karni-data-table-max-heightand--karni-data-table-row-heighttokens, thex-karni-relatedOpenAPI extension andKarniAutoSchema.get_karni_related, the spec's{detail: {related: [...]}}and dashboard pages other thanhome,karni make page --kind dashboard(--count) and--related, and thecomponentskey ofkarni ui detect --json. - Field groups and column sets:
karni.fields.MarkdownField(and itsmarkdowntype inkarni make modeland the spec),karni.api.formats(FormattedCharField, a model field'sopenapi_format), theclass Karnioptionsfield_groups,field_group_layoutandcolumn_sets,karni.layout, thex-karni-field-groupsandx-karni-column-setsOpenAPI extensions withKarniAutoSchema.get_karni_field_groupsandget_karni_column_sets,KarniAdminMixin.derive_fieldsets, the spec's entitygroups(nowKarni.field_groups) andcolumn_sets, thefieldGroupsandgroupLayoutprops of ResourceForm and ResourceDetail, ResourceTable'scolumnSets,columnSetandonColumnSetChange, and theFieldGroupDef,FieldGroupLayout,FieldGroupsDef,ColumnSetDefandColumnSetsDeftypes in@karni/ui. - AI extraction: the karni-ai module (
karni_ai, itsPOST /api/ai/extract/endpoint and answer,/api/ai/, theAICallmodel, theKARNI_AI_*settings and each provider's key and model settings, theai.extractthrottle scope,karni_ai.providers,karni_ai.extraction,karni_ai.schema,karni_ai.sources,karni_ai.services.fetch,karni_ai.usage) and@karni/ai-ui(ExtractButton,ExtractPreview,useExtract). - Family events:
declare,publish,subscribe,once,Event,Declaration,Subscriber,RegistryandCONTRACTinkarni.events, thekarni.outboxapp (its models, admin, tasks, beat entries,karni.outbox.delivery,dispatch,checksandhealth), theKARNI_EVENTS_DISPATCHER,KARNI_EVENTS_MAX_ATTEMPTSandKARNI_EVENTS_RETENTION_DAYSsettings, theevents:lines ofkarni check, the outbox rows inkarni trace, karni-payments'payments.*events, andcapture_events,deliver_nowandassert_events_declaredinkarni.testing. - Timeline: the
karni.timelineapp (its modelsTimelineEntryandTimelineLink, admin, task and beat entry,karni.timeline.api,access,checks,servicesandsubscribers),record,prune,render,parse_option,write_from_event,live_person,connect,disconnect,installedandCONTRACTinkarni.timeline, thetimeline=option ofdeclare(),GET /api/timeline/, theKARNI_TIMELINE_*settings, the timeline titles of the people events and ofpayments.payment.succeeded, and the person karni-payments' events carry. - Notifications: the
karni.notifyapp (its modelsEmailTemplate,Notification,ChoiceandUnsubscribe, admin, task and beat entry,karni.notify.api,viewsets,editor,moves,source,adopt,checksandservices),send,Sent,Recipient,recipients,holders,on_event,choices,choose,unsubscribe,resubscribe,unsubscribed,unsubscribe_url,unread_count,mark_read,mark_unread,prune,installedandCONTRACTinkarni.notify, thechannels=andreplace=arguments andCHANNELS,deliverandis_silencedofkarni.mail,/api/inbox/,/api/email-templates/,/api/notify/unsubscribe/,features.notify, and theKARNI_NOTIFY_*andKARNI_MAIL_SOURCEsettings. - The family rules: the architecture rules
part-imports-part,part-role-prefixandpart-route(K315),karni.testing.parts(installed_parts,references_in,check_part_imports,check_part_roles,check_part_routes), and the//form of thekarni: allow(...)marker. - The module catalog: the
karni.module.tomlmanifest format and the feature manifests, thekarni.modulesentry point group,karni.catalog(withpython -m karni.catalog),karni.testing.assert_module_manifest,karni modules listandshow,karni remove, theCATALOG:lines ofkarni context, theFEATURES:line ofmanage.py karni_context, andkarni_cli.catalog. - The /new-app flow: the
new-appprocedure and rule K311, recipes (karni recipes listandshow,--matchand its ranking, the blank start, therecipe.tomlformat and its schema, thekarni.recipesentry point group,karni recipes --jsonand its schema,karni_cli.recipes), and the MCP toolsrecipes,spec_validate,questions,answer,plan,buildandmoduleswith their results' schema (karni_cli.agent_tools). - The built-in recipes:
shop,booking,crm,lms,marketplaceanddata-portal(their specs, files and names),karni new --recipe, therecipekey of.karni/build.json(Record.recipe), the stub rule (karni_cli.recipes.apply,karni_cli.builder.render.is_stub_file,karni_cli.recipes.karni_owned) and therecipespytest marker of karni-cli's suite. - Tree models:
karni.models.TreeModelandOrderedTreeModel,karni.managers.TreeQuerySetandTreeManager,karni.tree,karni.api.tree(thetree/,children/,ancestors/andmove/endpoints,?parent=,?descendants_of=andDELETE ?branch=),BaseViewSet.serves_tree,tree_actions,tree_max_nodes,tree_default_depth,tree_max_depth,tree_top_level()andget_tree_node_serializer_class(), thex-karni-treeextension,karni.admin.treeandtree_changelist_max_rows, thehand-written-treerule, thetreekey ofkarni.yamland thetreefact, theuse<Name>Treehooks ofkarni types, andTreeView,TreeSelect,TreeBreadcrumb,useResourceTree,useResourceChildren,useResourceAncestorsanduseTreeMutationsin@karni/ui. - The tree scope: the
tree:<path>scope (with thetreevalue ofRolePermission.scope),karni.accounts.tree_scope,karni.accounts.grants.user_key, theaccess/endpoint of a tree resource (BaseViewSet.access_forest,karni.api.tree.tree_access_serializer), thetree:<field>options of the permission matrix, thetreeentry of akarni whygrant in--json,tree:<path>in akarni.yamlrole grant, anduseResourceAccessForestandTreeView'saccessin@karni/ui. - Navigation from data: the
KARNI_NAVIGATIONandKARNI_NAVIGATION_PAGESsettings,karni.navigation(withkarni.navigation.api,karni.navigation.checksandkarni.navigation.admin), thekarni.navigationapp and itsNavItemmodel, thenavigation/endpoint, thenavigationkey ofkarni.yamlandkarni_cli.spec.navigation, anduseNavigation,karniKeys.navigation,navigationEntries,activeRoute,defaultNavIcons,navIcon,isNavGroup,LayoutNavGroup, theNavGroupslot andLayout'snavSource,pathnameandiconsin@karni/ui. - Pages behind a capture without a model:
karni_site.sitemaps.pagesanddeclared_pages, and the page test's*declared_pages()thatkarni make sitewrites. - Taxonomies:
class Karni: taxonomies,karni.taxonomy,karni.api.taxonomy(the?<key>=and?<key>_descendants=filters, thefacets/andtagged/endpoints),BaseViewSet.facet_queryset(),taxonomy_actions,serves_facets()andserves_tagged(), thex-karni-taxonomyextension,originofkarni.tree.walk_sql, thetaxonomiesfact, thetaxonomieskey ofkarni.yaml, andFacetPanel,useResourceFacetsandResourceTable'sfacetsin@karni/ui.
Stable since 0.4.1:
- Response caching:
Cache,Uncached,karni.api.caching(invalidate,invalidation_batch,clear,access_scope,dependencies,normalized_query,cache_enabled,flush_time,FlushTime,CACHE_HEADERandBYPASS_HEADER),BaseViewSet.cache,get_cache_scopeandget_response_cache, theKARNI_API_CACHE,KARNI_API_CACHE_TTL,KARNI_API_CACHE_ALIASandKARNI_API_CACHE_FLUSHsettings, theX-Cacheresponse header and theX-Bypass-Cacherequest header, thekarni.E410,E411andW580checks, thekarni-flush-api-cacheschedule and its taskkarni.tasks.flush_api_cache, andkarni.admin.cache(the API cache screen). TheX-Karni-Cacheheader is deprecated and goes in 1.0, with the transitional settingKARNI_API_CACHE_LEGACY_HEADER. The spec's keys for it (features: api_cache, an entity'scache:) follow the app spec, which is experimental. - Suggestions from code (the
SUG001toSUG007codes and their silencing rulessuggest-*,karni suggestand--jsonwithkarni-suggestions.schema.json,karni.suggestions,manage.py karni_suggest,karni_check --no-suggestionsand--suggestions-file,.karni/local/suggestions.json,KARNI_SUGGESTIONS, andC780andC781), - Tooling for large projects:
context slices
(
karni context --summary,--app,--modeland--max-tokens, the same flags ofmanage.py karni_context,karni.introspect'ssummary_context,app_context,model_context,field_text,resolve_appsandresolve_models), the check cache (karni check --changed [REF]and--no-cache,manage.py karni_check --changedand--no-cache,.karni/local/check-cache.json,.karni/local/eslintcache,karni.testing.checkcacheandKARNI_CHECK_CACHE), volume seeding (karni seed --volumeand--batch-size,karni.bulk_seeding, thevolume,bulkandbatch_sizearguments ofkarni.seeding.seed,karni.seeding.volume_rows, the seed ledger.karni/local/seeded.json, the report'svolume,bulkandtimings,KARNI_SEED_BULK_THRESHOLD,KARNI_SEED_BATCH_SIZEandKARNI_SEED_LEDGER), the scaling settings (KARNI_SCALING_ROWS,karni.performance.Scaling,scaling_rows,query_scalingon a viewset, andScalingResult'srows,seconds,budget,endpoint,too_slowandslow_message()), query plans (karni queries --explain's analysis on PostgreSQL,karni.api.explain, theseq_scansof--jsonandKARNI_EXPLAIN_SEQ_SCAN_ROWS), the seed volume ofkarni plan(karni_cli.spec.plan.seed_time_class, theseed_bulk_thresholdfact) andscripts/benchmark/large_project.pywith its baseline. - The
karni-reportsmodule: the whole ofkarni_reports(Report,register,get_report, the renderers,GeneratedReport,karni_reports.services), theKARNI_REPORTS_*settings, the/api/reports/endpoints and their throttle scopes, the base print templatekarni_reports/base.htmland its blocks,manage.py karni_pregenerate, anduseReportandReportButtonin@karni/reports-ui. The six-letter code prefix (REPORT001) is not experimental: codes keep their meaning. - The
karni-storagemodule: the whole ofkarni_storage(ProtectedFileField,ProtectedImageField, the presets, the storage, the tokens,Thumbnail,karni_storage.thumbnails), theKARNI_STORAGE_*settings, the<resource>/<id>/files/<field>/,upload/andconfirm/endpoints and their answers,x-karni-storagein the schema, theapplication/vnd.karni.uploadreference part,manage.py karni_thumbnails, thefile:protectedandimage:protectedfield types, and everything in@karni/storage-ui. - The
karni-commercemodule: the whole ofkarni_commerce(the models, theSellableadapter and its registry,karni_commerce.services, the signals ofkarni_commerce.events,karni_commerce.fulfilment, the checkout validator, the email kinds), theKARNI_COMMERCE_*settings, the cart and order endpoints and their answers, and everything in@karni/commerce-ui.karni.mail(send_templated, itskindandKARNI_MAIL_DISABLED_KINDS) is experimental too. - The
karni-gamemodule: the whole ofkarni_game(the models, the services, the hooks ofkarni_game.hooks, the family eventsgame.*,karni_game.merge.Merger, the signatures, the roles), theKARNI_GAME_*settings, the game API and its answers, and thegamekind ofkarni new. - The game client: everything in
@karni/game(the portal, its adapters and the portal table, the loop, view, input, audio, save and random helpers, the data client and its queue, the Vite preset, the package checks, thekarni-gamecommand, the engine adapters and the smoke harness). - API versions: the
KARNI_API_VERSION,KARNI_API_VERSIONSandKARNI_API_UNVERSIONEDsettings,karni.api.versions(withapi_urls,ApiVersionHeadersMiddlewareandVersionedSchemaGenerator), thex-karni-api-versionsextension,app.api_versioninkarni.yaml, and a client per version fromkarni types. - Health checks:
/healthzand/readyz(karni.health.probe_urls,karni.health.views.readyz,karni.health.checks.check_broker), theKARNI_READYZ_CHECKS,KARNI_HEALTH_TIMEOUTandKARNI_LOG_QUIET_PATHSsettings, andkarni.conf.logging.QuietPaths. The older/health/and/health/ready/keep the promise.
Supported platforms¶
| Component | Supported |
|---|---|
| Python | 3.12, 3.13, 3.14 (3.14 from 0.3.0) |
| Django | 5.2 LTS |
| Node.js (frontend tooling) | 20.19+ for projects (Vite 8), 22.12+ to develop Karni itself (Vitest 5) |
| React | 18, 19 |
| PostgreSQL | 16+ (production). SQLite works for development and tests. |
Dropping a supported Python, Django or Node version is a minor-release change that is announced one minor release ahead. Adding one can happen in any minor release.