The best solution is to use the --path=<…> argument, but you don't seem to want to use that solution. An alternative solution is to add
\ctxlua{context.usepath{file.dirname(environment.inputfilename)}}
to the top of the input file, which will automatically add the file's parent directory to the list of files to search.
But if you don't want to add this to the top of all of your files, you can add something similar to the file cont-loc.mkxl, which is automatically input for each run. I wouldn't recommend this solution though, since it will make your documents non-portable.
$ tree -al foo/
foo/
├── a.tex
└── b.tex
1 directory, 2 files
$ cat foo/a.tex
\environment b
\starttext
A \tikz \draw (0,0) -- (1,1);
\stoptext
$ cat foo/b.tex
\usemodule[tikz]
$ cd foo/
$ context a.tex > /dev/null && echo Good || echo Bad
Good
$ cd ..
$ context foo/a.tex > /dev/null && echo Good || echo Bad
Bad
$ context --path=./foo foo/a.tex > /dev/null && echo Good || echo Bad
Good
$ TEXMFHOME=./foo context foo/a.tex > /dev/null && echo Good || echo Bad
Good
(Now modify `a.tex`)
$ cat foo/a.tex
\usepath[./foo]
\environment b
\starttext
A \tikz \draw (0,0) -- (1,1);
\stoptext
$ context foo/a.tex > /dev/null && echo Good || echo Bad
Good
$ mkdir bar && cd bar/
$ context ../foo/a.tex > /dev/null && echo Good || echo Bad
Bad
$ cd ..
(Now modify `a.tex`, again)
$ cat foo/a.tex
\ctxlua{context.usepath{file.dirname(environment.inputfilename)}}
\environment b
\starttext
A \tikz \draw (0,0) -- (1,1);
\stoptext
$ context foo/a.tex > /dev/null && echo Good || echo Bad
Good
$ cd bar/
$ context ../foo/a.tex > /dev/null && echo Good || echo Bad
Good
$ cd ..
(Now reset `a.tex` back to the original)
$ cat foo/a.tex
\environment b
\starttext
A \tikz \draw (0,0) -- (1,1);
\stoptext
$ mkdir -p $(mtxrun --resolve-path TEXMFCONFIG | head -1)/tex/context/
$ echo '\ctxlua{context.usepath{file.dirname(environment.arguments.input)}}' > $(mtxrun --resolve-path TEXMFCONFIG | head -1)/tex/context/cont-loc.mkxl
$ context foo/a.tex > /dev/null && echo Good || echo Bad
Good
$ cd bar/
$ context ../foo/a.tex > /dev/null && echo Good || echo Bad
Good
\ctxlua is the command that you use to run Lua code inline in ConTeXt (similar to \directlua). Any functions in the context table map to TeX macros; see the CLD Manual §2.2 for more details. So the following two lines are precisely equivalent:
\ctxlua{context.usepath { "/some/path/" }} % Option 1
\usepath[/some/path/] % Option 2
ConTeXt has a macro that gives us the name of the current file (\jobname), but it doesn't have any macros to extract the directory component of a path. However, there is a Lua function that does this (file.dirname), so we can use that instead. But cont-loc.mkxl is loaded early in the compile process, before \jobname is populated, so we instead need to use the alternative Lua variable environment.arguments.input.
Putting this all together gives us
\ctxlua{context.usepath{file.dirname(environment.arguments.input)}}
--path:context --path=a a/a.texor put\usepath[a]in the filea.tex. So it seems the paths are relative to running command directory not the document itself. Is it any way to change it?/aand/bwhere you at the top show your structure, i.e., is itfoo/a/a.texandfoo/b/b.texyou are using?contextwithinfoodirectory.foo/a.texandfoo/b.texi.e. all files are in a single directory, where you runcontext.foo/a/a.texandfoo/a/b.tex?