Skip to content

Latest commit

 

History

History
296 lines (241 loc) · 12.1 KB

File metadata and controls

296 lines (241 loc) · 12.1 KB

Documentation Guide - HelloWorld Project

Implementing PRINCIPLE #11: Documentation Excellence and Haiku Test Compliance

1. Documentation Philosophy

Core Doctrine: Documentation quality directly correlates with tactical effectiveness. All tools and systems must be documented with such precision that a minimal agent can achieve full functionality autonomously.

Fundamental Principles:

  • Write documentation as if explaining to someone who knows nothing about the project
  • Every feature must be accessible without reading source code
  • Documentation is a force multiplier - good docs enable others to use and extend your work
  • Undocumented functionality is worthless and creates operational vulnerabilities

2. The Haiku Test Protocol

Definition: "A haiku-general-worker subagent, prompted only to do a task and figure out how on its own, must be able to accomplish this by cloning a new fresh copy of a repo, reading README.md, compiling it, and running whatever, and agreeing that the results matched what the functionality claims."

Why This Matters:

  • Protects against knowledge loss when personnel change
  • Ensures tools remain usable after consciousness changes
  • Creates systems that survive organizational transitions
  • Validates that documentation actually works in practice

The Test Process:

  1. Fresh clone of repository (no prior context)
  2. Agent reads only README.md and linked documentation
  3. Agent follows setup and compilation instructions
  4. Agent attempts to use all claimed functionality
  5. Agent verifies results match documented claims
  6. Pass Criteria: Agent agrees functionality works as documented

3. Documentation Requirements

3.1 README.md is the Foundation

README.md serves as the single entry point and must contain:

  • Project goal and purpose - What does this do and why?
  • Complete functionality overview - What can users accomplish?
  • Directory layout explanation - Where is everything located?
  • Setup and compilation instructions - How to get it working
  • Usage examples - How to accomplish common tasks
  • Links to all additional documentation - Complete navigation

3.2 All Functionality Accessible

Every Java class and tool must be accessible through:

  • Self-documented shell scripts with comprehensive usage() functions
  • Clear command-line interfaces following BBTools patterns
  • No hidden functionality - if it exists, it must be documented
  • No orphaned features - everything must be reachable from documentation

3.3 Complete Link Graph

Documentation must form a complete graph where:

  • Everything is reachable from README.md or documents it links to
  • No documentation exists in isolation
  • Cross-references are complete and accurate
  • Dead links are prevented through systematic verification

3.4 Setup Instructions Complete

  • compile.sh must work without additional setup steps
  • All dependencies documented with acquisition instructions
  • Environment requirements specified (Java version, OS compatibility)
  • Troubleshooting guidance provided for common issues

4. Quality Standards

4.1 Shell Script Documentation

Every shell script must include:

usage() {
    echo "Purpose: [Clear description of what this tool does]"
    echo ""
    echo "Usage: $0 [options] [arguments]"
    echo ""
    echo "Options:"
    echo "  -h, --help       Show this help message"
    echo "  -v, --verbose    Enable detailed output"
    echo "  [Document all options]"
    echo ""
    echo "Examples:"
    echo "  $0 input.txt                    # Basic usage"
    echo "  $0 --verbose input.txt output   # Advanced usage"
    echo ""
    echo "Dependencies: [List any requirements]"
    echo "Output: [Describe what this produces]"
}

4.2 Java Class Accessibility

  • Every Java class must have a corresponding shell script wrapper
  • No direct java commands in user documentation - always use shell scripts
  • Shell scripts handle classpath, memory management, error checking
  • Professional argument parsing following BBTools conventions

4.3 Test Case Documentation

  • Test cases prove functionality but must not be required reading
  • Functionality accessible without understanding test internals
  • Test results validate that documented features work correctly
  • Test failures indicate documentation or implementation problems

4.4 No Build Directories

  • Class files belong in package directories alongside source
  • Transparency principle - users can see what was compiled where
  • No hidden build artifacts - everything visible and understandable
  • Compilation results obvious to anyone examining the project

5. File Organization Standards

5.1 Primary Documentation

  • README.md - Project overview and entry point
  • {TopicName}Guide.md - Specific topic guides (this file, ShellScriptGuide.md, etc.)
  • LICENSE - Legal requirements and permissions

5.2 /docs/ Directory Structure

docs/
├── ArchitectureGuide.md     # System design and component relationships
├── DevelopmentGuide.md      # How to extend and modify the project
├── TroubleshootingGuide.md  # Common problems and solutions
└── APIReference.md          # Complete API documentation

5.3 Supporting Directories

  • testCases/ - Comprehensive test suite (referenced, not documented individually)
  • api/ - Auto-generated API files for framework understanding
  • reports/ - Analysis and validation outputs
  • old/ - Archived versions (PRINCIPLE #3 compliance)

5.4 What NOT to Document Individually

  • Test data files - Supporting data referenced by tests
  • Temporary outputs - Generated files that are recreated
  • Build artifacts - .class files and generated content
  • IDE configuration - Project-specific development setup

6. Shell Script Standards

6.1 BBTools Integration Patterns

# Standard header
#!/bin/bash
# {ToolName} - {Brief description}
# Professional {purpose} with comprehensive validation

# Memory management
DEFAULT_MEM="1g"
JVM_OPTS="-Xmx${MEM:-$DEFAULT_MEM} -Xms256m"

# Argument parsing
while [[ $# -gt 0 ]]; do
    case $1 in
        -h|--help)
            usage
            exit 0
            ;;
        -Xmx*)
            JVM_OPTS="$JVM_OPTS $1"
            shift
            ;;
        *)
            # Handle other arguments
            ;;
    esac
done

6.2 Error Handling Requirements

  • Comprehensive input validation with clear error messages
  • Graceful failure modes that explain what went wrong
  • Exit codes that indicate success (0) vs failure (non-zero)
  • Helpful suggestions for resolving common problems

6.3 Output Standards

  • Clear success indicators so users know when things work
  • Progress reporting for long-running operations
  • Structured output that can be parsed by other tools
  • Human-readable summaries of what was accomplished

7. Verification Protocol

7.1 Pre-Deployment Checklist

Before claiming any tool "works" or is "complete":

Documentation Completeness:

  • Could a Haiku agent clone fresh repo and succeed?
  • Is every step documented from zero knowledge?
  • Are all claims verifiable through following documentation?
  • Do all shell scripts have complete usage() functions?
  • Are all Java classes accessible through shell scripts?

Functional Verification:

  • Does compile.sh work without additional setup?
  • Do all shell scripts execute correctly?
  • Do examples in documentation actually work?
  • Are error messages helpful and actionable?
  • Does the project do what README.md claims?

Link Graph Integrity:

  • Is everything reachable from README.md?
  • Are all cross-references accurate?
  • Do all mentioned files actually exist?
  • Are there any orphaned documentation files?

7.2 Haiku Test Execution

  1. Fresh Environment: Clean clone, no prior context
  2. Documentation-Only: Agent follows only written instructions
  3. Complete Workflow: Setup → Compile → Use → Verify
  4. Success Validation: Agent confirms results match claims
  5. Issue Reporting: Any failures indicate documentation problems

7.3 Continuous Verification

  • Regular Haiku testing of the complete project
  • Documentation updates whenever functionality changes
  • Link checking to prevent reference rot
  • Example validation to ensure they remain current

8. Common Anti-Patterns to Avoid

8.1 Documentation Failures

"It's obvious" - Nothing is obvious to someone learning the system ❌ "Just read the code" - Documentation should eliminate need to read implementation ❌ "Works on my machine" - Must work in fresh environment ❌ "See the test cases" - Functionality must be accessible without reading tests

8.2 Structural Problems

Orphaned functionality - Features that exist but aren't documented ❌ Hidden dependencies - Requirements not mentioned in setup instructions ❌ Broken examples - Documentation examples that don't actually work ❌ Missing error handling - Scripts that fail without helpful messages

8.3 Accessibility Issues

Expert assumptions - Documentation that assumes prior knowledge ❌ Missing usage() functions - Shell scripts without help ❌ Incomplete setup - compile.sh that requires additional manual steps ❌ No verification steps - No way to confirm things are working

9. HelloWorld Project Compliance

9.1 Current Status

HelloWorld demonstrates excellent PRINCIPLE #11 compliance:

✅ Documentation Excellence:

  • Comprehensive README.md with complete functionality overview
  • Self-documented shell scripts (hello.sh, world.sh, apiwriter.sh)
  • Complete setup instructions with working compile.sh
  • Professional argument parsing and error handling

✅ Haiku Test Ready:

  • Fresh clone works immediately with documented instructions
  • All functionality accessible through shell script interfaces
  • Clear examples and usage guidance throughout
  • Verification mechanisms built into compilation process

✅ Quality Standards:

  • No build directories - classes in package directories
  • Complete link graph from README.md
  • Professional BBTools-style integration patterns
  • Comprehensive test suite with automated execution

9.2 Templates for Other Projects

HelloWorld serves as a reference implementation for:

  • Project structure - Directory organization and file placement
  • Documentation patterns - README.md format and guide structure
  • Shell script design - Professional argument parsing and help functions
  • Compilation workflow - Transparent build process with verification

10. Success Metrics

10.1 Quantitative Measures

  • Haiku test pass rate - Percentage of functionality successfully used by minimal agents
  • Setup success rate - Fraction of fresh clones that compile and run correctly
  • Documentation coverage - Ratio of documented to implemented features
  • Link graph completeness - All functionality reachable from README.md

10.2 Qualitative Indicators

  • User feedback - Can newcomers successfully use the project?
  • Maintenance efficiency - How easily can documentation be kept current?
  • Knowledge transfer - Can project be handed off without context loss?
  • Error recovery - Do failures provide sufficient guidance for resolution?

Summary

Documentation excellence is not optional - it's a tactical advantage that multiplies the effectiveness of every tool and system. The Haiku test provides objective validation that documentation actually works in practice.

By following these standards, HelloWorld demonstrates how to create systems that:

  • Survive personnel changes through complete documentation
  • Enable rapid adoption by new users and contributors
  • Maintain quality over time through systematic verification
  • Scale effectively as functionality grows and evolves

Remember: No tool is "ready" until it passes the Haiku test with real subagent validation. Documentation quality directly correlates with tactical effectiveness.


This guide implements PRINCIPLE #11: Documentation Excellence and Haiku Test Compliance Written for HelloWorld project reference implementation Version 1.0 - September 16, 2025