Work with the help system
Use the help system when you need to scan a project for features, generate or maintain help templates, surface progressive-depth content to users, or record and query template feedback.
Prerequisites
- Access to the project source code
- Python environment with
attune-helpinstalled - A
features.yamlmanifest in your help directory (seeload_manifest/save_manifest)
Steps
-
Scan the project and build a feature manifest. Call
scan_project()with your project root to discover features from source files. Review the returnedProposedFeaturelist, then pass the accepted proposals toproposals_to_manifest()to produce aFeatureManifest.from help.bootstrap import scan_project, proposals_to_manifest proposals = scan_project("path/to/project") manifest = proposals_to_manifest(proposals) -
Generate templates for each feature. Pass a
Featureobject, your help directory, and the project root togenerate_feature_templates(). Setoverwrite=Trueonly when you want to replace existing files. The function raisesValueErrorif the feature name is invalid.from help.generator import generate_feature_templates result = generate_feature_templates( feature=manifest.features["my-feature"], help_dir="help/", project_root="path/to/project", overwrite=False, ) print(f"Generated {len(result.templates)} template(s)") -
Check and repair stale templates. Run
check_staleness()to compare stored source hashes against the current state of matched files. IfStalenessReport.stale_countis greater than zero, callrun_maintenance()to regenerate outdated templates. Usedry_run=Truefirst to preview what will change.from help.staleness import check_staleness from help.maintenance import run_maintenance, format_status_report report = check_staleness(manifest, help_dir="help/", project_root="path/to/project") print(report.stale_features) result = run_maintenance("help/", "path/to/project", dry_run=True) print(f"Stale: {result.stale_count}, would regenerate: {result.regenerated_count}") -
Populate and render a template. Call
populate()with a template ID and an optionalAudienceProfileto get aPopulatedTemplate. Pass the result to one of the renderer functions to produce output for your target channel.from help.templates import populate, AudienceProfile from help.transformers import render_cli, render_claude_code template = populate( "tas-my-feature", audience=AudienceProfile(channel="claude-code", verbosity="normal"), ) print(render_cli(template)) -
Surface contextual help for workflows and files. Use
get_workflow_help()to retrieve relevant templates after a named workflow completes, orget_precursor_warnings()to surface warnings when a specific file is about to be edited.from help.feedback import get_workflow_help, get_precursor_warnings workflow_templates = get_workflow_help("deploy", max_results=3) file_warnings = get_precursor_warnings("models.py", max_results=3) -
Record feedback and query confidence. After a user rates a template, call
record_template_feedback()with the template ID and rating. Retrieve the resulting confidence score, or callget_template_confidence()at any time to check a template's current score.from help.feedback import record_template_feedback, get_template_confidence score = record_template_feedback("tas-my-feature", rating="helpful") print(f"Updated confidence: {score:.2f}") current = get_template_confidence("tas-my-feature") -
Verify the system is healthy. Run
pytest -k "help-system"to catch regressions across template loading, progressive depth, cross-link resolution, and renderer output. See the help system testing quickstart for full test patterns.
Success criteria
generate_feature_templates()returns aGenerationResultwith at least one entry inresult.templatesand no feature name inMaintenanceResult.failed.run_maintenance()reportsregenerated_count > 0for any features that were stale, andstale_countdrops to zero on a second run.populate()returns a non-NonePopulatedTemplate, and each renderer (render_cli,render_claude_code,render_marketplace) produces non-empty output.- All
pytest -k "help-system"tests pass.
Key files
help/bootstrap.py—scan_project(),proposals_to_manifest()help/generator.py—generate_feature_templates()help/maintenance.py—run_maintenance(),run_hook(),get_changed_files(),format_status_report()help/staleness.py—check_staleness(),compute_source_hash()help/manifest.py—load_manifest(),save_manifest(),match_files_to_features(),resolve_topic()help/feedback.py—record_template_feedback(),get_template_confidence(),get_usage_weights(),search_by_tag(),list_tags(),get_workflow_help(),get_precursor_warnings()help/templates.py—populate(),AudienceProfile,TemplateContext,PopulatedTemplatehelp/transformers.py—render_cli(),render_claude_code(),render_marketplace()