ProjectContext API
The project object passed to every standard's evaluate function provides these methods:
Methods
project.get_file_content(path) -> str | None
Read the content of a file by its path. Returns None if the file doesn't exist.
content = project.get_file_content("README.md")
if content and "## Contributing" in content:
# Has a contributing section
project.get_file_size(path) -> int | None
Size of a file in bytes, including files you cannot read as text (images,
audio, wasm). Known for artifact projects;
None on Git repositories.
project.read_file_lines(path, start=1, count=100) -> dict | None
Part of a file as numbered lines, for reading large or minified files a page at
a time. Lines longer than 200 characters (a minified bundle is often one line)
are first broken after ;, ,, braces or parentheses. Each call returns about
5,000 characters at most and says where to continue (next_start, None at
the end). This is how an LLM standard's model reads big files;
get_file_content stays the raw file.
page = project.read_file_lines("assets/app.js")
# {"path": "assets/app.js", "total_lines": 2140,
# "lines": ["1: (function(){\"use strict\";", ...], "next_start": 61}
project.list_files() -> list[str]
List all file paths in the repository.
project.get_languages() -> dict[str, float]
Language breakdown as percentages.
project.get_members() -> list[dict]
Project members with roles.
project.get_contributors() -> list[dict]
Contributors with commit counts.
project.get_default_branch() -> str
Name of the default branch.
project.get_topics() -> list[str]
Repository topics/tags.
project.get_metadata() -> dict
General repository metadata.
meta = project.get_metadata()
# {
# "name": "my-project",
# "description": "A cool project",
# "web_url": "https://github.com/org/my-project",
# "created_at": "2024-01-01T00:00:00Z",
# "updated_at": "2024-06-01T00:00:00Z",
# }
project.get_file_last_commit_date(path: str) -> str | None
ISO 8601 timestamp of the most recent commit that touched path on the
default branch. Returns None if the file does not exist or has no
commit history. Useful for staleness / freshness checks on specific
tracked files.
Execution environment
- Standards run in isolated gVisor containers with no network access
- Execution timeout: 30 seconds
- Memory limit: 128 MB
- Only the
projectAPI is available — no filesystem, no imports beyond the standard library - For an artifact project,
projectreads the uploaded commit's files; members, contributors, topics and commit dates are empty