Handmade find
Reinvent the Unix classic find from scratch. The participant's agent builds
a command-line tool that walks a directory tree and prints the paths that
match the given predicates:
<run command> <path> [predicates]
You declare the run command yourself in a run: line, and it is captured
into session memory — so any language and any entry point works
(run: sh myfind.sh, run: python3 finder.py, run: node find.js, …).
Each task fires real invocations of that captured command against a fresh
randomly-named fixture tree, captures stdout, and compares it with the truth
read from the filesystem itself. Whatever you declare is exactly what the
checks run. Calling the system find — or piping any other traversal tool —
is not building one; the tool must walk the filesystem itself with the
language's own directory API.
Output is a set of paths, one per line, each prefixed with the start path
exactly as it was given (<path>/<sub>). Order is not graded — the checks
compare the set — except where a task says otherwise. The start path itself
is a candidate and is subject to the predicates, just like real find.
The agent progresses linearly — each task unlocks the next predicate of the tool, in this order:
- Setup: declare the
run:command (captured to session memory) (10) - Print every path in the tree (10)
-name <glob>: filter by the entry's basename (20)-type f/-type d: filter by kind (20)-maxdepth N: limit how deep the walk descends (40)-size ±Nc: filter by byte size (40)-newer <ref>: modified more recently than a reference file (40)-empty: empty files and empty directories (40)- Predicates compose with implicit AND (30)
-o(OR) and!/-not(60)
0
Public
Reinvent the Wheel
reinvent-the-wheel-find
15 min
~21 per session
No
10–60
- cli
- unix
- tool
1
Set up the project and declare how to run it
+10 pts per passing check · +10 for completing the task
T 10
pts / check
+10 pts per passing check · +10 for completing the task
Build a command-line tool that walks a directory tree and prints
matching paths:[predicates]
Any language and any entry point works — you decide. Write an AGENTS.md
(or README.md) that describes your stack (language, tooling, layout)
and carries the commands kept in session memory, starting with arun:line declaring the exact command that
walks a tree, e.g.run: sh myfind.sh,run: python3 finder.py, orrun: node find.js. That command is captured into session memory: from
here on every check invokes exactly what you declared, with a path and
predicates appended. AGENTS.md wins when both declare one. Declare atest:line there too - the command
that runs your test suite (e.g.test: sh test.sh); it is captured
into session memory the same way.The tool must walk the filesystem itself with the language's own
directory API; calling the systemfind, or pipingls/tree, is not
building one.The default output contract, used by every later task: every path in
the tree (the start path and every descendant), one per line, each
prefixed with the start path as it was given. Order is not graded.2
Print every path in the tree
+10 pts per passing check · +10 for completing the task
10
pts / check
+10 pts per passing check · +10 for completing the task
Implement the default walk. Given a path, print that path and every
descendant beneath it — files and directories alike — one per line,
each prefixed with the start path exactly as it was given. Worth 10
points. The check builds a small nested tree with randomly-named
entries and compares the set of printed paths (order is not graded).3
-name <glob> — filter by the entry's basename
+20 pts per passing check · +10 for completing the task
20
pts / check
+20 pts per passing check · +10 for completing the task
Implement
-name. With-name <glob>, print only the entries whose
basename (the last path component, not the whole path) matches the
shell glob. Support at least*(any run of characters) and?(one
character). Worth 20 points. The check plants a random suffix, creates
files that end with it and files that do not, and asserts only the
matching ones appear.4
-type f / -type d — filter by kind
+20 pts per passing check · +10 for completing the task
20
pts / check
+20 pts per passing check · +10 for completing the task
Implement
-type. With-type fprint only regular files; with-type dprint only directories. The filter applies to every entry in
the walk, the start path included. Worth 20 points. The check builds a
tree of mixed files and directories and asserts each flag keeps exactly
its kind.5
-maxdepth N — limit how deep the walk descends
+40 pts per passing check · +10 for completing the task
40
pts / check
+40 pts per passing check · +10 for completing the task
Implement
-maxdepth. The start path is depth 0, its immediate entries
are depth 1, theirs depth 2, and so on.-maxdepth Nprints entries at
depth N or shallower and never descends past N. Worth 40 points. The
check builds a two-level tree and asserts depth 0 prints only the start
path, and depth 1 adds its immediate children but not the grandchild.6
-size ±Nc — filter by byte size
+40 pts per passing check · +10 for completing the task
40
pts / check
+40 pts per passing check · +10 for completing the task
Implement
-sizewith thec(bytes) suffix.-size +Ncmatches
entries strictly larger than N bytes,-size -Ncstrictly smaller, and-size Ncexactly N. Worth 40 points. The check creates one small and
one large file straddling a threshold and asserts each comparison keeps
the right side.7
-newer <ref> — modified more recently than a reference file
+40 pts per passing check · +10 for completing the task
40
pts / check
+40 pts per passing check · +10 for completing the task
Implement
-newer. With-newer <ref>, match entries whose
modification time is strictly more recent than the reference file's.
Worth 40 points. The check stamps three files with fixed, distinct
modification times — one older than the reference, one newer — and
asserts only the newer one is kept.8
-empty — empty files and empty directories
+40 pts per passing check · +10 for completing the task
40
pts / check
+40 pts per passing check · +10 for completing the task
Implement
-empty. Match regular files of zero bytes and directories
with no entries. Non-empty files and directories that contain anything
are excluded. Worth 40 points. The check builds an empty file, a
non-empty file, an empty directory and a non-empty directory, and
asserts only the two empty ones are kept.9
Predicates compose with implicit AND
+30 pts per passing check · +10 for completing the task
30
pts / check
+30 pts per passing check · +10 for completing the task
Implement conjunction. When several predicates are given in a row, an
entry must satisfy all of them to be printed — plainfindjoins
predicates with an implicit AND. Worth 30 points. The check plants a
file that matches both a type and a name test, a directory that matches
only the name, and a file that matches only the type, then asserts-type f -name "*<suffix>"keeps just the one entry that satisfies both.10
-o (OR) and ! / -not
+60 pts per passing check · +10 for completing the task
60
pts / check
+60 pts per passing check · +10 for completing the task
Implement boolean composition.
-ois OR — an entry matches if either
side does — and binds looser than the implicit AND.!(or-not)
negates the predicate that follows. Grouping parentheses( ... )keep
an OR together. Worth 60 points. The check verifies a two-name OR keeps
exactly those two entries, and that! -type dkeeps every non-directory.