8 Conclusion

8.1 Summary

This paper has presented template_pools_rules_tools, a meta-project exemplar demonstrating how research software projects embedded in a monorepo can integrate three categories of shared resources — data pools (fonds), governance rules, and executable tools — without tight coupling to any specific resource instance. The key contributions are:

  1. A four-module architecture (fonds_reader, rules_applier, tools_invoker, integration) that provides a canonical pattern for resource-aware project code in the template repository. Each module is independently testable and independently deployable.

  2. A typed manifest convention (fonds.yaml, rules.yaml, tools.yaml) that makes resource capabilities explicit and checkable at pipeline initialisation time, shifting failure detection from runtime to startup — a significant improvement for reproducibility (Wilson et al. 2014).

  3. A token injection pipeline that links manuscript prose to integration runtime statistics through doubled-brace, uppercase-key placeholders, ensuring that quantitative claims in the manuscript are always generated by the pipeline rather than authored manually. In the current run this covered 3 fonds, 2 rule sets, 4 tools, and 8 bibliography entries.

  4. A three-level resilience design — resource absence, schema malformation, and script absence — that allows the pipeline to degrade gracefully and report failures informatively rather than crashing, consistent with best practices for robust research software (Taschuk and Wilson 2017).

8.2 Design Decisions Revisited

Several design decisions deserve emphasis as lessons for future exemplar authors:

Repo-root-relative discovery is non-negotiable in a forkable monorepo. Any hard-coded absolute path or working-directory assumption will fail when the repository is cloned to a different location. The pathlib.Path(__file__).resolve().parents[N] idiom used throughout src/ ensures that discovery works from any working directory.

Graceful fallbacks over exceptions is the correct trade-off for a resource-consumption layer. The alternative — raising FileNotFoundError when a fond is missing — would make the integration pipeline fragile to the ordering of parallel agent writes. Returning None and logging a warning allows the pipeline to produce a complete, if partial, result dict that downstream consumers can reason about.

Real-file tests over mocks is required for a template exemplar. Mocks can pass tests while the real discovery logic is silently broken. Tests that use real file paths exercise the full path-resolution chain and catch regressions that mocks would miss.

Thin orchestration scripts keep the scripts directory readable and focus all testable logic in src/. A script that does more than parse arguments, call a src/ function, and write output is accumulating business logic that belongs elsewhere.

8.3 Limitations

This exemplar makes several deliberate simplifications that a reader adopting the pattern should be aware of:

The no-concurrency-handling limitation above is not merely theoretical: this exemplar is itself designed to be populated by parallel agents authoring fonds/, rules/, and tools/ concurrently, which is precisely the scenario where a torn read is most likely. Adopters running this pattern in a genuinely concurrent write environment should add file locking or an atomic-rename write pattern at the resource-authoring layer — this exemplar deliberately does not, to keep the reader-side code minimal.

8.4 Future Directions

The three-layer architecture described here is deliberately extensible. The most natural extension is a fourth resource category: models (models/<scope>/<name>/) for pre-trained machine learning models and their inference scripts. The pattern would follow exactly the same manifest-and-reader design, with models.yaml declaring type, version, and entrypoints, and a models_loader module providing discover_models() and validate_model_files_exist(). Adding this layer to template_pools_rules_tools would require only a new reader module and a new section in the integration orchestrator — the existing architecture places no constraints on the number of resource categories.

A second direction, cross-fond validation, is now implemented: src/integration.py::check_bibliography_overlap() compares this manuscript’s own cite keys against the template_bibliography fond’s curated set and reports overlap, project_only, and fond_only counts. It deliberately does not assert full containment in either direction — this manuscript legitimately cites software-engineering sources the fond does not curate, and the fond legitimately curates machine-learning sources this manuscript does not cite. Run uv run python -c "from src.integration import check_bibliography_overlap; import json; print(json.dumps(check_bibliography_overlap(), indent=2))" from the project root to see the current overlap.

A third direction, suggested directly by the Limitations above, was extending strong_rule_evaluator with additional rule kinds beyond the original four. The manifest_freshness kind — flagging a fond whose version field has not been bumped despite its data/ files changing more recently than its manifest — is now implemented: src/strong_rule_evaluator.py::_evaluate_manifest_freshness() is a fifth dispatch entry, unit-tested against synthetic rule dicts (tests/test_strong_rule_evaluator.py). It is deliberately not yet wired to a real strong-rule YAML file: doing so would mean adding a file under the shared rules/templates/template_project_rules/strong/ or rules/templates/template_manuscript_rules/strong/ directory, which this project’s own read-only contract against fonds/, rules/, and tools/ reserves for an explicit decision rather than a routine content edit. The evaluator’s logic is proven correct against synthetic input; proving it against a real fond’s real manifest and data-file timestamps is the natural next step, pending that decision.

The exemplar is ready to fork. A project team wishing to adopt this architecture need only copy the relevant src/ modules (the three readers plus integration.py are the minimum; strong_rule_evaluator.py and figures.py are optional extensions), update the resource directory paths in each reader, and replace the exemplar fond/rules/tool names with their own.