Skip to content

Latest commit

 

History

History
109 lines (89 loc) · 5.7 KB

artifact-aware-generation.md

File metadata and controls

109 lines (89 loc) · 5.7 KB

Artifact-aware generation

New in 2.0. On by default.

Why

CodeWiki documents what is in its dependency graph. In 1.x the graph was built only from source files. Everything else was dropped before the first node was created: Dockerfiles, CI workflows, build definitions, package manifests, configuration and schema files. None of it reached a module, so none of it was documented. Across the seven CodeWikiBench wikis generated by 1.x there was not one mention of GitHub Actions.

2.0 treats these files as artifacts: first-class nodes in the dependency graph. They get clustered, documented, and cross-linked like code.

What counts as an artifact

Files are classified by name, extension, and directory. Nine classes:

Class Examples
manifest package.json, pyproject.toml, setup.py, setup.cfg, Cargo.toml, go.mod, build.zig.zon, lake-manifest.json, lean-toolchain, Gemfile, pnpm-workspace.yaml
build Makefile, CMakeLists.txt, configure.ac, Makefile.am, m4/*.m4, build.zig, lakefile.lean, lakefile.toml, *.gradle, BUILD.gn, *.gni, DEPS, Rakefile, rakelib/*.rake, build/
container Dockerfile*, Containerfile, docker-compose*.yml, files under docker/
ci .github/workflows/*.yml, .github/actions/*/action.yml, .gitlab-ci.yml, Jenkinsfile, ci/, .circleci/
packaging debian/, rpm/, pkg/, packages/, *.spec, *.service, install and lifecycle scripts
test_infra pytest.ini, conftest.py, tox.ini, noxfile.py, vitest.config.*, jest.config.*, playwright.config.*
schema *.proto, *.fbs, openapi.*, *.schema.json
config files under config/, etc/, settings/; root-level *.toml, *.yml, *.yaml, *.ini, *.cfg, *.conf, *.options
script *.sh near the root, files under bin/, scripts/, tools/, hack/

Never artifacts: lock files, binary files, files under tests/, fixtures/, vendored code, issue and PR templates, CODEOWNERS, and plain source files (a .py file is code, unless it is a known build or test-infra file such as setup.py or conftest.py).

Prose is excluded by default. README files and anything under docs/ are explanations written by people, not artifacts. CodeWiki leaves them out so the generated documentation is built from the repository itself. Pass --with-prose to add a tenth class, prose, that reads the root README, CONTRIBUTING, and docs/*.md.

How artifacts enter the graph

  1. One node per file, with type artifact, id <path>::<file name>, and the file content as its source. Where a cheap parser exists, one child node per unit as well: a CI job, a Dockerfile stage, a Makefile target, a library or program a Makefile.am builds, a configure.ac option, a package.json script, a pyproject entry point.
  2. Edges to the code they reference, from per-format heuristics that need no language runtime: a Dockerfile COPY or ENTRYPOINT path, a CI run: line, a Makefile recipe calling a script, a Makefile.am _SOURCES list, a configure.ac AC_CONFIG_FILES entry, a [project.scripts] target, a package.json main or bin path, a compose build.context. These edges are shallow. They connect artifacts to code well enough for clustering and cross-links. They are not a call graph.
  3. Clustering sees them with one added instruction: artifact components describe how the system is built, packaged, shipped, configured, and tested; group them into their own module or attach them to the module they configure.
  4. A guaranteed module. Clustering is an LLM call and can still drop nodes. If fewer than 80% of the artifact nodes end up in the module tree, CodeWiki inserts a top-level module named Build, Deployment and Configuration holding every unplaced artifact. Coverage does not depend on the clustering model keeping them.
  5. An artifact index is written to <output>/temp/artifact_index.json: per class, the file paths with sizes and unit names. A rendered version of this index goes into every module prompt and the overview prompt, so an agent documenting a code module can look up the CI job or Dockerfile that builds it and cite it.

Caps

Large repositories carry a lot of configuration. Three caps keep artifact text bounded:

Cap Default
Head of each file that is read 16 KB (the rest is replaced by a "truncated" marker)
Files per class 40
Total artifact text per repository 200,000 tokens (--artifact-token-budget)

When the total cap binds, classes are kept in this priority order: manifest, build, container, ci, packaging, test_infra, schema, config, script, prose.

Flags

codewiki generate                                   # artifacts on (default)
codewiki generate --no-artifacts                    # code only, 1.x behaviour
codewiki generate --artifact-token-budget 100000    # tighter total cap
codewiki generate --with-prose                      # also read README and docs/
codewiki generate --artifact-exclude "docker/data/*,config/generated/*"

--artifact-exclude is for repositories with large generated configuration trees. Patterns match the relative path or the file name, and a bare directory name skips that directory.

What it changed on the benchmark

On the seven CodeWikiBench repositories, artifacts add between 0.4% and 4.7% to the node count. The score effect concentrates where you would expect: the build topic went from 28.2 (1.x) to 71.9 (2.0), and requirements whose evidence lives in a supporting artifact went from 57.4 to 75.5. Code- grounded requirements were not hurt. Full numbers are in the README.