This vignette documents putior’s capabilities for AI assistants (like Claude, ChatGPT, or GitHub Copilot). It’s designed to be read by language models to understand how to use putior effectively.
If you’re a human reader, you probably want one of these instead:
| Guide | Description |
|---|---|
| Quick Start | Create your first diagram in 2 minutes |
| Annotation Guide | Complete syntax reference |
| Quick Reference | Printable cheat sheet |
| API Reference | Full function documentation |
| Troubleshooting | Common issues and solutions |
This content is automatically available via:
putior_guide() - Returns this
documentation as a stringputior_mcp_server()/runs
endpoint from putior_acp_server()When running as an MCP or ACP server, AI assistants can:
putior_guide
toolput toolput_diagram
toolput_auto
toolSee the MCP Server section in CLAUDE.md for setup instructions.
putior’s procedural documentation lives in the agent-almanac repository, which provides 6 skills for the complete putior workflow:
| Skill | Purpose |
|---|---|
install-putior |
Installation and dependency setup |
analyze-codebase-workflow |
Auto-detect workflows in arbitrary codebases |
annotate-source-files |
Add PUT annotations to source files |
generate-workflow-diagram |
Generate themed Mermaid diagrams |
configure-putior-mcp |
Set up MCP/ACP server for AI assistants |
setup-putior-ci |
GitHub Actions CI/CD for diagram auto-refresh |
The content below is the same as returned by
putior_guide():
For step-by-step procedures, see the agent-almanac putior skills: install-putior, analyze-codebase-workflow, annotate-source-files, generate-workflow-diagram, configure-putior-mcp, setup-putior-ci
Access this guide without running R:
| Method | URL |
|---|---|
| Web Page | https://pjt222.github.io/putior/articles/ai-integration.html |
| Raw Markdown | https://raw.githubusercontent.com/pjt222/putior/main/inst/GUIDE.md |
| GitHub View | https://github.com/pjt222/putior/blob/main/inst/GUIDE.md |
For R users: putior_guide(output = "raw") returns this
content as a string.
Add # put comments to source files to define workflow
nodes:
# put id:"load", label:"Load Data", output:"raw_data.csv"
data <- read.csv("input.csv")
# put id:"transform", label:"Clean Data", input:"raw_data.csv", output:"clean.rds"
clean <- transform(data)
# put id:"analyze", label:"Run Analysis", input:"clean.rds", node_type:"decision"
results <- analyze(clean)| Property | Required | Description | Example |
|---|---|---|---|
id |
Yes | Unique node identifier | id:"load_data" |
label |
No | Display text (defaults to id) | label:"Load CSV" |
input |
No | Input files/data (comma-separated) | input:"a.csv, b.csv" |
output |
No | Output files/data | output:"result.rds" |
node_type |
No | Shape: input, process (default), output, decision, start, end | node_type:"decision" |
Use backslash for continuation:
Languages using // comments also support PUT annotations
inside /* */ and /** */ blocks:
/**
* put id:"handler", label:"Request Handler", \
* input:"request.json", output:"response.json"
*/
function handleRequest(req, res) { ... }Use * put as the line prefix inside block comment
bodies.
putior automatically detects comment style by file extension (18 languages with auto-detection, 30+ total):
| Prefix | Languages | Extensions |
|---|---|---|
# put |
R, Python, Shell, Julia, Ruby, Perl, YAML, Dockerfile, Makefile | .R, .py, .sh,
.jl, .rb, .pl,
.yaml, Dockerfile, Makefile |
-- put |
SQL, Lua, Haskell | .sql, .lua, .hs |
// put |
JavaScript, TypeScript, C, C++, Java, Go, Rust, Swift, Kotlin, C#, PHP, WGSL | .js, .ts, .c,
.cpp, .java, .go,
.rs, .wgsl |
% put |
MATLAB, LaTeX | .m, .tex |
put() - Extract Annotations# Scan directory for annotations
workflow <- put("./R/")
# Scan specific file
workflow <- put("./scripts/pipeline.R")
# Custom file pattern
workflow <- put("./src/", pattern = "\\.py$")
# Enable debug logging
workflow <- put("./R/", log_level = "DEBUG")
# Exclude test files
workflow <- put("./R/", exclude = "test")put_diagram() - Generate Diagrams# Basic diagram
put_diagram(workflow)
# Customize appearance
put_diagram(workflow,
direction = "LR", # Left-to-right (default: TB top-bottom)
theme = "github", # Theme: github, light, dark, auto, minimal
show_artifacts = TRUE # Show data files as nodes
)
# Colorblind-safe themes (viridis family)
put_diagram(workflow, theme = "viridis") # Purple-blue-green-yellow
put_diagram(workflow, theme = "magma") # Warm: purple-red-yellow
put_diagram(workflow, theme = "plasma") # Vibrant: purple-pink-yellow
put_diagram(workflow, theme = "cividis") # Blue-yellow (max accessibility)
# Interactive features
put_diagram(workflow,
enable_clicks = TRUE, # Make nodes clickable
click_protocol = "vscode", # vscode, rstudio, or file
show_source_info = TRUE # Show source file in nodes
)
# Output options
put_diagram(workflow, output = "clipboard") # Copy to clipboard
put_diagram(workflow, output = "workflow.md") # Save to file
mermaid_code <- put_diagram(workflow, output = "raw") # Return as stringput_auto() - Auto-Detect WorkflowAnalyze code to detect inputs/outputs without annotations:
# Auto-detect from R files
workflow <- put_auto("./R/")
# Control what to detect
workflow <- put_auto("./src/",
detect_inputs = TRUE,
detect_outputs = TRUE,
detect_dependencies = TRUE
)
# Combine with manual annotations
workflow <- put_merge("./src/", merge_strategy = "supplement")
# Exclude vendor/test directories
workflow <- put_auto("./src/", exclude = c("vendor", "test"))Languages with pattern-based detection (902 patterns total):
| Language | Patterns | Key Libraries |
|---|---|---|
| R | 124 | readr, data.table, DBI, arrow, ellmer |
| Python | 159 | pandas, numpy, sqlalchemy, transformers, langchain |
| JavaScript | 71 | Node.js fs, Express, mongoose, Prisma |
| TypeScript | 88 | All JS + NestJS, TypeORM |
| Java | 73 | NIO, JDBC, Jackson, Spring Boot |
| Ruby | 64 | File, CSV, Rails, ActiveRecord |
| Rust | 60 | std::fs, serde, sqlx, diesel |
| Go | 44 | os, bufio, database/sql, gorm |
| C++ | 44 | fstream, boost, std::filesystem |
| MATLAB | 44 | readtable, imread, h5read |
| Julia | 27 | CSV.jl, DataFrames, JLD2 |
| C | 24 | stdio.h, POSIX, mmap |
| Lua | 20 | io library, loadfile |
| WGSL | 17 | GPU bindings, textures, samplers, naga-oil |
| Dockerfile | 13 | FROM, COPY, ADD, EXPOSE, VOLUME, CMD, RUN |
| Shell | 12 | cat, redirects, source |
| Makefile | 10 | include, wildcard, target rules, install |
| SQL | 8 | FROM, JOIN, COPY |
Detects modern AI/ML libraries:
R: ellmer (chat(),
chat_openai(), chat_claude()), tidyllm, httr2
API calls
Python: ollama, openai, anthropic, langchain, transformers, litellm, vllm, groq
# Get comment prefix for extension
get_comment_prefix("sql") # Returns "--"
get_comment_prefix("js") # Returns "//"
# List supported extensions
get_supported_extensions()
# List supported languages
list_supported_languages() # All 30+ languages
list_supported_languages(detection_only = TRUE) # 18 with auto-detection
# Get detection patterns
patterns <- get_detection_patterns("python")
patterns <- get_detection_patterns("r", type = "input")
# Available themes
get_diagram_themes()
# Interactive help
putior_help()| Type | Mermaid Shape | Use For |
|---|---|---|
input |
Stadium ([...]) |
Data sources, file loading, API inputs |
process |
Rectangle [...] (default) |
Data processing, transformations |
output |
Subroutine [[...]] |
Report generation, exports, final outputs |
decision |
Diamond {...} |
Conditional logic, branching workflows |
start |
Stadium ([...]) |
Workflow entry point (special boundary styling) |
end |
Stadium ([...]) |
Workflow exit point (special boundary styling) |
artifact |
Cylinder [(...)] |
Data files (auto-created with
show_artifacts = TRUE) |
Note:
artifactnodes are automatically created byput_diagram()whenshow_artifacts = TRUE. They are not set manually vianode_type.
| Theme | Use Case |
|---|---|
light |
Bright colors (default) |
dark |
Dark mode environments |
auto |
GitHub-adaptive with solid colors |
minimal |
Print-friendly, grayscale |
github |
Optimized for README files |
viridis |
Colorblind-safe (purple-blue-green-yellow) |
magma |
Colorblind-safe (purple-red-yellow) |
plasma |
Colorblind-safe (purple-pink-yellow) |
cividis |
Maximum accessibility (blue-yellow) |
Launch browser-based annotation playground:
Then use knitr::knit_child() to embed as native Mermaid
chunk.
Enable debug output for troubleshooting:
# Set globally
options(putior.log_level = "DEBUG")
set_putior_log_level("DEBUG")
# Per-call override
workflow <- put("./R/", log_level = "DEBUG")Levels: DEBUG, INFO, WARN
(default), ERROR
put_auto() for unfamiliar
codebases to quickly understand data flowput_generate() to create
annotation templates users can customizeput_merge() when combining
manual and auto-detected workflowsshow_artifacts = TRUE to
visualize data file dependenciesenable_clicks = TRUE for navigable
documentation| Guide | Description |
|---|---|
| Quick Start | First diagram in 2 minutes |
| Annotation Guide | Complete syntax reference |
| Features Tour | Auto-detection, themes, logging |
| API Reference | Function documentation |
| Showcase | Real-world examples |
| Quick Reference | At-a-glance reference card |
| Troubleshooting | Common issues and solutions |