Text Diff
text.diff_text
Overview
Computes a structured diff between two text inputs using Myers algorithm. Supports line, word, and character granularity. Returns hunks, operations, unified diff output, and summary statistics. Accepts file input via file_ref — no need to extract file content first.
LLMs cannot reliably compute precise line- or word-level diffs. We use Myers' algorithm to give you exact, structured change information every time.
Reliability
STRICT and deterministic — Myers' algorithm produces optimal shortest-edit diffs. Identical inputs always yield identical hunks, stats, and unifiedDiff. We return at most 500 hunks while stats still count every change, and a line diff that hits the cap adds truncated: true. Input validation (not retryable): a granularity outside line, word, character; neither text nor file_ref on a side; both on a side; either side longer than 1,048,576 characters, or 10,000 at character granularity.
Context footprint
Each side accepts inline text up to ~1M chars or file_ref (up to 2 MB). Diff output exceeding 100 KB is stored as a downloadable file automatically. A successful call costs 2 execution credits.
When to use it
When you need deterministic change detection between two text versions at line, word, or character granularity.
Do not use to apply patches, compare binary files, or resolve three-way merge conflicts.
Powered by java-diff-utils, a battle-tested implementation of Myers' diff algorithm trusted across the JVM ecosystem.
Scope
Non-goals
- Does not apply patches or merge changes
- Does not perform three-way merge or conflict resolution
- Does not compare binary content
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
File limits
Constraints this skill applies to your input and generated files. The “Limited by” column shows the static source of each cap; none of these can be raised by upgrading your plan.
| Limit | Value | Limited by |
|---|---|---|
| Maximum size per input file | 1.9 MiB | Skill maximum |
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| oldText | string | No | Old inline text. Required unless old_file_ref is provided. |
| old_file_ref | string | No | Old tenant-scoped file reference. Omit it when oldText is supplied. |
| newText | string | No | New inline text. Required unless new_file_ref is provided. |
| new_file_ref | string | No | New tenant-scoped file reference. Omit it when newText is supplied. |
| granularity | string | No | Comparison granularity; omit it for line. |
| contextLines | integer | No | Unified-diff context lines; omit it for three. |
| ignoreWhitespace | boolean | No | Whether whitespace-only differences are ignored; omit it for false. |
| outputToFile | boolean | No | Whether a large diff is stored as a file; omit it for false. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| hunks | array | Yes | Bounded array of ordered difference hunks with type, positions, source, and target properties. The item shape is defined by the nested schema and the array contains from 0 through 2000000 items. |
| stats | object | Yes | Purpose-bound count map for added, removed, changed, and unchanged units. Its purpose-bound receipt properties are bounded to 64 entries — unconstrained RFC 8259 JSON items. |
| granularity | string | Yes | Applied comparison granularity. |
| identical | boolean | Yes | Whether the compared texts are identical under the options. |
| unifiedDiff | string | No | Optional bounded unified-diff rendering. |
| unifiedDiffTruncated | boolean | No | Whether the unified-diff rendering was cut at 512 KB. Present only when the cap was hit. |
| truncated | boolean | No | Whether hunks omitted deltas beyond the first 500. Present only when the hunk cap was hit. |
| file_ref | string | No | Stored unified-diff reference when returned by file. |
| download_url | string | No | Temporary platform download URL when returned by file. |
| size_bytes | integer | No | Returned diff UTF-8 byte size. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"text.diff_text","input":{"oldText":"hello world","newText":"hello there world"}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("text.diff_text", {"oldText":"line1\nline2\nline3","newText":"line1\nline2 modified\nline3\nline4"});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- Does not apply patches or merge changes
- Does not perform three-way merge or conflict resolution
- Does not compare binary content
- Applying or merging diffs programmatically
- Binary file comparison
- Three-way merge or conflict resolution
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "text.diff_text",
"input": {
"oldText": "line1\nline2\nline3",
"newText": "line1\nline2 modified\nline3\nline4"
}
}Examples
Line-level diff with unified output
{
"oldText": "line1\nline2\nline3",
"newText": "line1\nline2 modified\nline3\nline4"
}{
"stats": {
"changed": 1,
"added": 1,
"removed": 0,
"unchanged": 2
},
"granularity": "line",
"unifiedDiff": "--- old\n+++ new\n@@ -1,3 +1,4 @@\n line1\n-line2\n+line2 modified\n line3\n+line4",
"identical": false,
"hunks": [
{
"sourcePosition": 2,
"sourceLines": [
"line2"
],
"type": "change",
"targetLines": [
"line2 modified"
],
"targetPosition": 2
},
{
"sourcePosition": 4,
"sourceLines": [],
"type": "insert",
"targetLines": [
"line4"
],
"targetPosition": 4
}
]
}Word-level insertion
{
"granularity": "word",
"newText": "hello there world",
"oldText": "hello world"
}{
"identical": false,
"granularity": "word",
"stats": {
"changed": 0,
"added": 2,
"removed": 0,
"unchanged": 3
},
"hunks": [
{
"source": [],
"type": "insert",
"target": [
"there",
" "
]
}
]
}Recommended use cases
- Compare document or configuration versions
- Track prompt or template evolution over time
- Audit generated content for unexpected regressions
Avoid for
- Applying or merging diffs programmatically
- Binary file comparison
- Three-way merge or conflict resolution
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.